【问题标题】:Transfering A CSV File From Cloud Storage Into A BigQuery Partitioned Table Using BigQuery Transfer Service使用 BigQuery Transfer Service 将 CSV 文件从云存储传输到 BigQuery 分区表
【发布时间】:2021-04-24 07:22:27
【问题描述】:
我创建了一个 BigQuery 表,按月分区。
我现在想使用 BigQuery 传输将存储在 Google Cloud Storage 中的 CSV 传输到表中。
但是,我的最后一次尝试失败了。对于我输入的目标表:table_a${run_time|"%m%d"} 但返回以下错误:
Invalid monthly partitioned partition key: 0117(它在 1 月 17 日运行。因此是 0117。)
鉴于该表已按月分区,我应该为目标表添加什么?
【问题讨论】:
标签:
google-cloud-platform
google-bigquery
【解决方案1】:
如果按月分区,则分区键为<year><month>,而你放<month><day>,例如
create or replace table yourtable (ts timestamp)
PARTITION BY TIMESTAMP_TRUNC(ts, month)
AS select timestamp '2020-1-1 1:00:00' ts;
创建的表将有一个分区:yourtable$202001