-
Notifications
You must be signed in to change notification settings - Fork 562
PYTHON-893: fallback implementation for namedtuple row factory #951
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
Conversation
|
||
def __getitem__(self, idx): | ||
return self._tuple[idx] | ||
|
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.
Could we just make that PseudoNamedTupleRow iterable, like a normal nametuple?
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.
oops, yep, should definitely do that.
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.
Fixed -- added __iter__
.
LGTM Jim! |
cassandra/query.py
Outdated
|
||
def pseudo_namedtuple_factory(colnames, rows): | ||
""" | ||
""" |
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.
I'm, wondering if we really wants to make this public ... 🤔
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.
What's the benefit to suggest users to use this instead of the dict_factory if they have the issue?
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.
This isn't given as a suggestion; it's a fallback row factory. I agree, there isn't any benefit to making this "public".
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.
Thoughts on this bit?
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.
Added an __iter__
and a __repr__
.
Do you think it's reasonable for this stuff to be public? I think it's ok; the documentation and naming should make it clear that you should rarely intentionally use this.
|
||
def __getitem__(self, idx): | ||
return self._tuple[idx] | ||
|
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.
Fixed -- added __iter__
.
cassandra/query.py
Outdated
|
||
def pseudo_namedtuple_factory(colnames, rows): | ||
""" | ||
""" |
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.
Thoughts on this bit?
LGTM Jim yep! |
b9460c9
to
0b889eb
Compare
Thanks for the review! I've added a docstring for the new factory and sqashed. Will merge after a clean test run 👍 |
0b889eb
to
16ae36b
Compare
Integration tests ran clean, travis failures will be addressed by the 3.3 removal recently merged to master. The Appveyor failures are known flakes. |
PYTHON-893.
As mentioned on that ticket, we've decided it's better to degrade to a pseudonamedtuple (with a warning) than to simply fail on very long lists of columns.