我正在尝试使用 Python API 创建一个 Bigquery 表。
from google.cloud import bigquery
bigquery_client = bigquery.Client(project="myproject")
dataset = bigquery_client.dataset("mydataset")
table = dataset.table("mytable")
table.create()
我一直收到这个错误
AttributeError: 'TableReference' object has no attribute 'create'
有人知道吗?
最佳答案
在倒数第二行 (table = dataset.table("mytable")
)。你需要这样做:
[..]
table_ref = dataset.table('my_table')
table = bigquery.Table(table_ref, schema=SCHEMA)
table = client.create_table(table)
[..]
参见 here .
关于python - 通过 Python API 创建 Bigquery 表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47826086/