0
2か月前に、次のコードをうまく実行しましたが、今度はgoogle.cloudを再インストールした後、 'TableReference'オブジェクトには属性が存在しません。私はDataset.nameを使用することはできません。そのAPIについての大きな変化が...そこに私は私のコードを再構築する必要があるように聞こえるBigQuery APIの重要な変更はありますか?
def createTable(client, ds, tb):
dataset = client.dataset(ds)
#assert not dataset.exists()
table = dataset.table(tb)
#assert not table.exists()
if not table.exists():
assert not table.exists()
table.schema = (bigquery.SchemaField('Name', 'STRING'),
bigquery.SchemaField('Age', 'INTEGER'),
bigquery.SchemaField('Weight', 'FLOAT'),)
table.create()
else:
print 'this table already existed in this dataset'
assert table.exists()
あなたが知らないうちにレガシーモードをオン/オフにしているかどうかを確認してください。 –
私はコードを参照していました:https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/bigquery/cloud-client/snippets.py use_legacy_sqlは含まれていませんか?あなたがこれを意味するのかどうかはわかりませんが、これはAPIについてですが、なぜレガシーモードを追加する必要があるのか理解できません。 – EmmaYang