- Notifications
You must be signed in to change notification settings - Fork1.6k
BigQuery: added methods for getting keys, items and dict#4393
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
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():googlebot commentedNov 14, 2017
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 visithttps://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
josefbarta commentedNov 14, 2017
I signed it! |
googlebot commentedNov 14, 2017
CLAs look good, thanks! |
dhermes commentedNov 14, 2017
I'd like to do a thorough review of the code (e.g. |
josefbarta commentedNov 14, 2017
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! |
josefbarta commentedNov 14, 2017
I fixed it after all; the tests seem to have run successfully :-) |
tswast commentedNov 15, 2017
I like What is your desired use for |
josefbarta commentedNov 16, 2017
I'm using |
tswast commentedNov 16, 2017
Yeah, I'd prefer not to have
Ooh, yes please to adding the |
googlebot commentedNov 17, 2017
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. |
josefbarta commentedNov 17, 2017
I signed it! |
googlebot commentedNov 17, 2017
CLAs look good, thanks! |
josefbarta commentedNov 17, 2017
So |
| '' | ||
| """ | ||
| index=self._xxx_field_to_index.get(key) | ||
| ifindexisNone: |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
tswast left a comment
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!
josefbarta commentedNov 17, 2017
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: