我有两个 Big Query 表,t1
和 t2
,它们都包含 _PARTITIONTIME
列。
我的目标是以保持_PARTITIONTIME
的方式将t2
中的行插入到t1
中
有没有办法将_PARTITIONTIME
插入为选定的变量?
或者是否有一种方法可以在插入行后追溯定义_PARTITIONTIME
列?
最佳答案
目前,您可以使用分区装饰器
写入分区
[TABLE_NAME]$20160501
但是,有一项高请求功能正在开发中,该功能允许您选择一列并将其用作分区日。
为了写入 20 个不同的分区,您需要创建至少 20 个不同的查询并按照说明进行写入 here
bq query --allow_large_results --replace --noflatten_results \
--destination_table 'mydataset.temps$20160101' \
'SELECT stn,temp from [bigquery-public-data:noaa_gsod.gsod2016] WHERE mo="01" AND da="01" limit 100'
bq query --allow_large_results --replace --noflatten_results \
--destination_table 'mydataset.temps$20160102' \
'SELECT stn,temp from [bigquery-public-data:noaa_gsod.gsod2016] WHERE mo="01" AND da="02" limit 100'
此处提供了更多解决方案: Migrating from non-partitioned to Partitioned tables
关于google-bigquery - Big Query 在从一个表插入另一个表时指定 _PARTITIONTIME,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47775030/