-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
BigQuery: timestamps not populated correctly for parameterized queries #2886
Comments
@tswast I have passing system tests which show the back-end sending {'_client': <google.cloud.bigquery.client.Client object at 0x7f399dfb33d0>,
'_configuration': <google.cloud.bigquery.query._SyncQueryConfiguration object at 0x7f399e250090>,
'_job': None,
'_properties': {u'cacheHit': True,
u'jobComplete': True,
u'jobReference': {u'jobId': u'job_N75jt8A_drBKYhdW9gbvuImxAWQ',
u'projectId': u'<MY-PROJECT-ID>'},
u'kind': u'bigquery#queryResponse',
u'rows': [{u'f': [{u'v': u'1.480941669E9'}]}],
u'schema': {u'fields': [{u'mode': u'NULLABLE',
u'name': u'f0_',
u'type': u'TIMESTAMP'}]},
u'totalBytesProcessed': u'0',
u'totalRows': u'1'},
'_query_parameters': (),
'_udf_resources': (),
'query': 'SELECT TIMESTAMP "2016-12-05 12:41:09"'} |
Your example seems to be using legacy SQL. Data types are different in standard SQL. But yes, the format expected by query parameters is different from the format in the response. |
Nope, all the queries in that system test pass the
That is a definite API smell, if not an outright bug: there should be one-and-only-one canonical way to spell the wire format for any given data type (as opposed to the formats humans might type in a query). |
Agreed, that's why I filed https://code.google.com/p/google-bigquery/issues/detail?id=842 |
Thanks! I verified this works with the sample I've written. |
- *Not* the float-time-since-epoch-in-seconds which Bigquery uses for all other TIMESTAMP values. :( - *Not* RFC3339, but the SQL-mandated format with an embedded space. :( Closes: googleapis#2886.
Attempt to use
TIMESTAMP
type in a scalar query parameter.GoogleCloudPlatform/python-docs-samples@a788ea1
The timestamp type should not be sent as a floating point value. It should take this format: https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#timestamp-type Note that this is different from RFC 3339. There is an issue open at https://code.google.com/p/google-bigquery/issues/detail?id=842 for accepting RFC 3339 in TIMESTAMP query parameters.
The text was updated successfully, but these errors were encountered: