google-bigquery - Big Query 在从一个表插入另一个表时指定 _PARTITIONTIME

标签 google-bigquery

我有两个 Big Query 表,t1t2,它们都包含 _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/

相关文章:

google-bigquery - bigquery.readonly 范围允许哪些操作?

python - 将数据帧上传到bigquery时,日期类型的对象不是JSON可序列化错误?

python - 如何从bigquery中的 View 获取保存的查询

google-bigquery - 无法运行查询 : project does not have the reservation in the data region

sql - 使用 BigQuery sql 转置行中的列

google-bigquery - 无法使用 Java Bigquery Client API 在 BigQuery 中写入日期

javascript - 使用#standardSQL 在 BigQuery 上运行异步 JS 函数

google-cloud-platform - 在 BIG QUERY 中进行透视时,行数据有空格时会出现错误。字段只能包含字母 数字 下划线 以字母或下划线开头

google-bigquery - 每次在 BigQuery 中由 UDF 处理一行后,如何更新所有行的列?

google-bigquery - BigQuery 中 count(*) 的值是如何确定的?