-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
BigQuery: added methods for getting keys, items and dict #4393
Conversation
This change enables to retrieve the row as a dict and iterate the keys and/or items, like with a normal dict; in other words, making the Row object a dict-like object: >>> row.dict() {'name': 'Isabel', 'profession': 'bridge builder'} >>> for k, v in row.items(): >>> for k in row.keys():
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
I signed it! |
CLAs look good, thanks! |
I'd like to do a thorough review of the code (e.g. |
I see, good point about the generators, thanks. I'd fix that but will hold off until we know more about whether these are desirable at all. The thing is that it would be great to be able to either return the row as a dict or convert it to a dict really easily, which currently is a bit of a hacky process. Thanks! |
I fixed it after all; the tests seem to have run successfully :-) |
I like What is your desired use for |
I'm using |
Yeah, I'd prefer not to have
Ooh, yes please to adding the |
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. |
I signed it! |
CLAs look good, thanks! |
So |
'' | ||
""" | ||
index = self._xxx_field_to_index.get(key) | ||
if index is None: |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
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.
Thanks for your contribution!
Thanks :-) |
This change enables to retrieve the row as a dict and iterate the keys and/or items, like with a normal dict; in other words, making the Row object a dict-like object: