簡體   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