-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update abstractdriver.py #55
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @vsarathy1, this looks good to me - I think its a great move going forward to have this code shared by the Mongo and Couchbase drivers (and indeed, all other drivers that use JSON-like documents). Just some nitpick comments - in particular, one that didn't register with me until today was the shadowing of the built-in tuple
.
@@ -63,6 +63,119 @@ def formatConfig(self, config): | |||
ret += "\n\n# %s\n%-20s = %s" % (desc, name, default) | |||
return (ret) | |||
|
|||
def getOneDoc(self, tableName, tuple, generateKey=False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: can we rename the parameter tuple
so that it doesn't shadow the Python built-in tuple
?
Maybe something like doc_tuple
or field_values
?
Same goes for getOneCH2Doc
, getOneCH2PPDoc
, genNestedTuple
etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
for l, k in enumerate(constants.KEYNAMES[tableName]): | ||
if l == 0: | ||
key = str(tuple[k]) | ||
else: | ||
key = key + '.' + str(tuple[k]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: we can write this perhaps more simply as
key = ".".join(str(tuple[k]) for k in constants.KEYNAMES[tableName])
Same in getOneCH2PPDoc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
No description provided.