Uh oh!
There was an error while loading. Please reload this page.
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():googlebot
commented
Nov 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 visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
josefbarta
commented
Nov 14, 2017
I signed it! |
googlebot
commented
Nov 14, 2017
CLAs look good, thanks! |
dhermes
commented
Nov 14, 2017
I'd like to do a thorough review of the code (e.g. |
josefbarta
commented
Nov 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
commented
Nov 14, 2017
I fixed it after all; the tests seem to have run successfully :-) |
tswast
commented
Nov 15, 2017
I like What is your desired use for |
josefbarta
commented
Nov 16, 2017
I'm using |
tswast
commented
Nov 16, 2017
Yeah, I'd prefer not to have
Ooh, yes please to adding the |
googlebot
commented
Nov 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
commented
Nov 17, 2017
I signed it! |
googlebot
commented
Nov 17, 2017
CLAs look good, thanks! |
josefbarta
commented
Nov 17, 2017
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.
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.
Thanks for your contribution!
josefbarta
commented
Nov 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: