Skip to content

BigQuery: timestamps not populated correctly for parameterized queries #2886

@tswast

Description

@tswast
  • Stacktrace
$ python sync_query_params.py timestamp
Traceback (most recent call last):
  File "sync_query_params.py", line 176, in <module>
    sync_query_timestamp_params()
  File "sync_query_params.py", line 124, in sync_query_timestamp_params
    query_results.run()
  File "/Users/swast/src/google-cloud-python/bigquery/google/cloud/bigquery/query.py", line 360, in run
    method='POST', path=path, data=self._build_resource())
  File "/Users/swast/venvs/bq-dml/lib/python3.5/site-packages/google/cloud/_http.py", line 335, in api_request
    error_info=method + ' ' + url)
google.cloud.exceptions.BadRequest: 400 Unparseable query parameter `ts_value` in type `TYPE_TIMESTAMP`, Invalid timestamp: '1.4810976E9' value: '1.4810976E9' (POST https://www.googleapis.com/bigquery/v2/projects/cloud-samples-tests/queries)
  • Steps to reproduce

Attempt to use TIMESTAMP type in a scalar query parameter.

  • Code example

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.

Metadata

Metadata

Assignees

Labels

api: bigqueryIssues related to the BigQuery API.backendtype: 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