I'm using the python bigquery api. I'm streaming data into a table and would like to store the data record generation timestamp in both UTC and the local time where the data was generated.

I'm passing in the following:

...
"timestamp_utc": "2014-04-04 09:01:10.762137+00:00",
"timestamp_local_time": "2014-04-04 11:01:10.762137+02:00",
...

Both of these result in columns with the time stored as 09:01:10 UTC. Is this a known limitation or am I doing something wrong?

有帮助吗?

解决方案

The Bigquery timestamp time does not record a timezone. The input time is always converted to and stored in UTC. Queries and table reads return the timestamp as a unix timestamp expressed as floating point seconds since the epoch 1970-01-01 00:00:00 UTC. The Web UI always renders times in the UTC timezone.

So to summarize the two times in your example are equivalent as far as the BigQuery timestamp type is concerned.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top