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

标签 google-bigquery

我有一个 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/

相关文章:

google-cloud-platform - 将数据流从 Google Cloud Storage 流式传输到 Bigquery

sql - BigQuery 时间戳(以毫米为单位):ss

validation - 在插入 BigQuery 表之前检查数据是否已经存在(使用 Python)

google-analytics - 如何将Google Analytics(分析)数据导出到Google GCS存储桶或BigQuery?

firebase - 如何在Bigquery中查询此自定义事件数据?

google-bigquery - Bigquery 标准 SQL "max_by"和 "regr_slope"函数

google-bigquery - BigQuery [PHP] 插入全部 : Not showing any error but BigQuery Table not affected with the inserted values

google-bigquery - 如何使用 node.js 客户端库计算已完成的 BigQuery 作业的行数

google-bigquery - 阻止查询 --destination_table 命令的输出

python - 如果我在 MapReduce 作业结束时清理 Google 存储,为什么 BigQuery 不更新?