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

Correctly model JSON repr of complex nested records. #2787

Merged
merged 2 commits into from
Dec 2, 2016
Merged

Correctly model JSON repr of complex nested records. #2787

merged 2 commits into from
Dec 2, 2016

Conversation

tseaver
Copy link
Contributor

@tseaver tseaver commented Nov 30, 2016

Closes #2354.

@tseaver tseaver added the api: bigquery Issues related to the BigQuery API. label Nov 30, 2016
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Nov 30, 2016
@@ -186,7 +186,7 @@ def test_w_scalar_subfield(self):
def test_w_repeated_subfield(self):
subfield = _Field('REPEATED', 'color', 'STRING')
field = _Field('REQUIRED', fields=[subfield])
value = {'f': [{'v': ['red', 'yellow', 'blue']}]}
value = {'f': [{'v': [{'v': 'red'}, {'v': 'yellow'}, {'v': 'blue'}]}]}

This comment was marked as spam.

This comment was marked as spam.

@daspecster
Copy link
Contributor

AFAICT this looks good. The nesting is a bit mesmerizing though. I would think a system test might be helpful? Should we make an issue to add a system test after this PR?

converter = _CELLDATA_FROM_JSON[subfield.field_type]
if field.mode == 'REPEATED':
value = [converter(item, subfield) for item in cell['v']]
if subfield.mode == 'REPEATED':

This comment was marked as spam.

@tseaver
Copy link
Contributor Author

tseaver commented Dec 2, 2016

@daspecster Good point -- I will add a system test using the examples I generated to test the stuff manually.

@tseaver tseaver merged commit 8ff90db into googleapis:master Dec 2, 2016
@tseaver tseaver deleted the 2354-bigquery-nested_data_types branch December 2, 2016 19:34
richkadel pushed a commit to richkadel/google-cloud-python that referenced this pull request May 6, 2017
richkadel pushed a commit to richkadel/google-cloud-python that referenced this pull request May 6, 2017
…data_types

Correctly model JSON repr of complex nested records.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the BigQuery API. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants