google-cloud-bigquery版本为1.5.0,并且堆栈在sdk代码中崩溃。有什么解决方法吗?
[2018-09-12 21:18:01,265] {base_task_runner.py:98} INFO - Subtask: query_job.result() # Waits for the query to finish
...
[2018-09-12 21:18:01,315] {base_task_runner.py:98} INFO - Subtask: raise exceptions.from_http_response(response)
[2018-09-12 21:18:01,316] {base_task_runner.py:98} INFO - Subtask: google.api_core.exceptions.BadRequest: 400 GET https://www.googleapis.com/bigquery/v2/projects/fsql-production/queries/[my job id]?maxResults=0: Cannot return an invalid timestamp value of 1534808046936000000 microseconds relative to the Unix epoch. The range of valid timestamp values is [0001-01-1 00:00:00, 9999-12-31 23:59:59.999999]; error in writing field request_started_at
答案 0 :(得分:1)
这表示查询中的错误,而不是客户端代码中的错误。错误是:
无法返回相对于Unix时期的1534808046936000000微秒的无效时间戳值。有效时间戳值的范围是[0001-01-1 00:00:00、9999-12-31 23:59:59.999999];写入字段request_started_at
时出错
听起来您的字段/列名为request_started_at
,但缩放比例不正确; 1534808046936000000
应该是1534808046936000
。 guide on migrating to standard SQL中有一些与此相关的材料。如果此列的所有值缩放比例均不正确,则可以执行以下操作来修复它们:
CREATE OR REPLACE dataset.table AS
SELECT *
REPLACE (TIMESTAMP_MICROS(DIV(UNIX_MICROS(request_started_at), 1000)) AS request_started_at)
FROM dataset.table
这会将列中的值缩小1000倍后替换。