繁体   English   中英

使用Python和API创建Bigquery分区表

[英]Create Bigquery partitioned table using Python and API

我想使用client.create_table()从Python脚本在BigQuery中创建分区表,但收到错误消息

TypeError:create_table()获得了意外的关键字参数'time_partitioning'`

如果有人能告诉我我要去哪里错,那将很棒。

这是我正在使用的代码:

client = bigquery.Client.from_service_account_json('path/to/key')
...
data_ref = bigquery.DatasetReference(PROJECT_ID, DATASET_ID)
table_ref = bigquery.TableReference(data_ref, new_TABLE_ID)
table = bigquery.Table(table_ref, schema = SCHEMA) 
new_table = client.create_table(table, time_partitioning = True)

这是我使用的一些文档

仅供参考

client = bigquery.Client.from_service_account_json('path/to/key')
... 
data_ref = bigquery.DatasetReference(PROJECT_ID, DATASET_ID)
table_ref = bigquery.TableReference(data_ref, new_TABLE_ID)
table = bigquery.Table(table_ref, schema = SCHEMA)
table.partitioning_type = 'DAY' 
client.create_table(table)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM