Timestamp format in google bigquery loses

According to another question , I did this (python) to push my timestamps onto bigquery (they come from a node-js application in nr-of-miliseconds format):

e["createdOn"] = e["createdOn"] / 1000.0 

But they end up like this:

 SELECT updatedOn,TIMESTAMP_TO_USEC(updatedOn) FROM [table.sessions] WHERE session = xxxxxxx Row updatedOn f0_ 1 2014-08-18 11:55:49 UTC 1408362949426000 2 2014-08-18 11:55:49 UTC 1408362949426000 

I print debugging information, and this is their last form before pasting with insertAll:

 {u'session': 100000000000080736, u'user': 1000000000075756, u'updatedOn': 1409052076.223} 
+5
source share
1 answer

I think you are mixing USEC (microseconds) and MSEC (milliseconds). You specify the timestamp in milliseconds, but then convert it to microseconds, in which the last three digits will be 0, because it is higher precision than you specified.

If you use the TIMESTAMP_TO_MSEC function instead, it should do what you expect.

+2
source

Source: https://habr.com/ru/post/1201149/


All Articles