2017-12-15 17 views
1

私はPython APIを使用してBigqueryテーブルを作成しようとしています。Python APIでBigqueryテーブルを作成する

私は誰もが任意のアイデアを持っていますか?このエラーに

AttributeError: 'TableReference' object has no attribute 'create'

を得続ける

from google.cloud import bigquery 

bigquery_client = bigquery.Client(project="myproject") 
dataset = bigquery_client.dataset("mydataset") 

table = dataset.table("mytable") 
table.create() 

答えて

1

TableReferenceオブジェクトが返されました。最後の2行目(table = dataset.table("mytable"))にはTableが含まれていません。これを行う必要があります:

[..] 
table_ref = dataset.table('my_table') 
table = bigquery.Table(table_ref, schema=SCHEMA) 
table = client.create_table(table) 
[..] 

hereを参照してください。

関連する問題