gpt4 book ai didi

google-bigquery - BigQuery 不处理分区列的毫秒时间戳

转载 作者:行者123 更新时间:2023-12-05 06:34:25 26 4
gpt4 key购买 nike

我有一个 unix 时间戳列,在我的 csv 文件中以毫秒表示。现在,当我将这些数据插入到我的 bigQuery 表中并查询它时,我得到了这个错误

bigQuery not supporting milliseconds timestamps

现在我想将此列作为分区列。我有几个问题1)即使保存为int64,如何在该字段上做分区列?2)我想避免重复表。

最佳答案

如果您的时间戳数据以毫秒表示,您将无法正确创建分区表。相反,您应该使用@TimBiegeleisen 所述的“TIMESTAMP 或 DATE 列”。时间戳 will use microsecond precision .一旦你的列以微秒为单位,你就可以使用类似下面的东西来创建分区表:

bq load --schema <your-timestamp-column>:TIMESTAMP,<some-other-column>:FLOAT --skip_leading_rows=1 --source_format=CSV --time_partitioning_field=<your-timestamp-column> <your-dataset>.<your-table> <your-csv-file>

(如果 csv 文件中有列名,请使用 --skip_leading_rows。)

如您所见in official docs here,使用标准 SQL 而非旧版查询您的表:

You cannot use legacy SQL to query partitioned tables or to write query results to partitioned tables.

关于google-bigquery - BigQuery 不处理分区列的毫秒时间戳,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50286217/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com