Skip to content

Deserializing JSON subfields within structs fails #1500

@jonathan-ostrander

Description

@jonathan-ostrander

Environment details

  • OS type and version: MacOS Ventura 13.1
  • Python version: 3.9.5
  • pip version: 22.3.1
  • google-cloud-bigquery version: 3.5.0

Steps to reproduce

  1. Create table with record field containing a JSON subfield
  2. Query record field and try to read row from query result

Code example

from google.cloud import bigquery bigquery.Client().query("SELECT record_with_json_subfield.* FROM <table>").result().__next__()

Stack trace

Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<stdin>", line 1, in <listcomp> File "lib/python3.9/site-packages/google/api_core/page_iterator.py", line 209, in _items_iter for item in page: File "lib/python3.9/site-packages/google/api_core/page_iterator.py", line 131, in __next__ result = self._item_to_value(self._parent, item) File "lib/python3.9/site-packages/google/cloud/bigquery/table.py", line 2710, in _item_to_row _helpers._row_tuple_from_json(resource, iterator.schema), File "lib/python3.9/site-packages/google/cloud/bigquery/_helpers.py", line 435, in _row_tuple_from_json row_data.append(_field_from_json(cell["v"], field)) File "lib/python3.9/site-packages/google/cloud/bigquery/_helpers.py", line 411, in _field_from_json return converter(resource, field) File "lib/python3.9/site-packages/google/cloud/bigquery/_helpers.py", line 368, in _record_from_json converter = _CELLDATA_FROM_JSON[subfield.field_type] KeyError: 'JSON' 

Metadata

Metadata

Assignees

Labels

api: bigqueryIssues related to the googleapis/python-bigquery API.priority: p2Moderately-important priority. Fix may not be included in 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