Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vsarathy1
Copy link
Contributor

No description provided.

@vsarathy1 vsarathy1 requested a review from d-nagy November 7, 2024 18:31
Copy link
Contributor

@d-nagy d-nagy left a 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):
Copy link
Contributor

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.

Comment on lines +76 to +80
for l, k in enumerate(constants.KEYNAMES[tableName]):
if l == 0:
key = str(tuple[k])
else:
key = key + '.' + str(tuple[k])
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants