GeezerVison is showing github.com — New Standard SQL Data Types Not Supported in gcloud._helpers._rows_from_json() / _CELLDATA_FROM_JSON() · Issue #2229 · googleapis/google-cloud-python
New Standard SQL Data Types Not Supported in gcloud._helpers._rows_from_json() / _CELLDATA_FROM_JSON() #2229Labels api: bigqueryIssues related to the BigQuery API.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns. DescriptionStandard SQL dialect support was added in 0.18.0, but current release does not support queries that return results that include data types that are not supported by Legacy SQL.
E.g. executing the following query using Standard SQL:
SELECT PARSE_DATE('%Y%m%d', '20160810') AS table_date;
results in
rows = query.rows
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/gcloud/bigquery/query.py", line 204, in rows
return _rows_from_json(self._properties.get('rows', ()), self.schema)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/gcloud/bigquery/_helpers.py", line 85, in _rows_
from_json
converter = _CELLDATA_FROM_JSON[field.field_type]
KeyError: u'DATE'
Not a significant issue since the Legacy SQL Data types will work for my needs, but wanted to report it all the same. Activityadded type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns. on Sep 6, 2016tseaver commented on Sep 6, 2016 abovethewater commented on Sep 19, 2016 Unfortunately there is no equivalent timezone functionality in the legacy SQL syntax, so this is a bit of an issue.
For anyone else blocked by this, the query actually works, and the raw data is available via
query._properties['rows']
If there is a preferable way to access this until fixed, then please recommend. daspecster commented on Sep 19, 2016 tseaver commented on Sep 19, 2016 @abovethewater, @toomtoom, @daspecster
- PR Support parsing DATE columns from Standard SQL tables #2265 added support for the
DATE type.
- We should be able to add the
INT64 and FLOAT64 standard types as trivial aliases for the legacy INT and FLOAT.
- The standard
BYTES type should be straightforward, if we can figure out how the back-end is expecting the values to be tunneled via JSON (I expect base64, but can't find it in the docs).
- Support for both
ARRAY and STRUCT are going to require reworking the current implementation, as the field types are no longer constant strings.
tseaver commented on Dec 5, 2016
AFAICT, the remaining standard SQL types which need support are BYTES (I just verified that the back-end marshals them as base64) and TIME.
MetadataMetadataapi: bigqueryIssues related to the BigQuery API.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns. DevelopmentNo branches or pull requestsIssue actions
|