Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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
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