Skip to content

Support (non-legacy) SQL nested data types #2354

Description

@dhermes

STRUCT<t> and ARRAY<t> seem to be the types.

See #2342. h/t to @c0b for filing.


From #2585: Sample app that reproduces this

Stacktrace:

Traceback (mostrecentcalllast):
File"simple_app.py", line57, in<module>query_shakespeare()
File"simple_app.py", line47, inquery_shakespearepage_token=page_token)
File"lib/python2.7/site-packages/google/cloud/bigquery/query.py", line401, infetch_datarows_data=_rows_from_json(response.get('rows', ()), self.schema)
File"lib/python2.7/site-packages/google/cloud/bigquery/_helpers.py", line98, in_rows_from_jsonforitemincell['v']])
File"lib/python2.7/site-packages/google/cloud/bigquery/_helpers.py", line61, in_record_from_jsonforsubfield, cellinzip(field.fields, value['f']):
KeyError: 'f'

Stepping into the debugger:

ipdb>value
{u'v': {u'f': [{u'v': u'hamlet'}, {u'v': u'5318'}]}}
ipdb>field.__dict__
{'field_type': u'RECORD', 'description': None, 'name': u'title', 'fields': [<google.cloud.bigquery.schema.SchemaFieldobjectat0x7f4ba9227550>, <google.cloud.bigquery.schema.SchemaFieldobjectat0x7f4ba9227690>], 'mode': u'REPEATED'}

(Added by @dhermes)

Metadata

Metadata

Assignees

Labels

api: bigqueryIssues related to the BigQuery API.release blockingRequired feature/issue must be fixed prior to next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions