【发布时间】:2018-09-05 02:44:24
【问题描述】:
我正在尝试将表从谷歌 bigQuery 导出到谷歌数据存储作为 json 文件。
运行这个 python sn-p
from google.cloud import bigquery
client = bigquery.Client()
bucket_name = 'mybucket'
destination_uri = 'gs://{}/{}'.format(bucket_name, 'myfile.json')
dataset_ref = client.dataset('mydataset')
table_ref = dataset_ref.table('mytable')
job_config = bigquery.job.ExtractJobConfig()
job_config.destination_format = (
bigquery.DestinationFormat.NEWLINE_DELIMITED_JSON)
extract_job = client.extract_table(
table_ref, destination_uri, job_config=job_config
)
extract_job.result()
我收到了这个错误
AttributeError: module 'google.cloud.bigquery' has no attribute 'DestinationFormat'
我按照官方文档 https://cloud.google.com/bigquery/docs/exporting-data#configuring_export_options
这里是我的 python 包版本
- google-api-core (1.1.0)
- google-auth (1.4.1)
- google-cloud-bigquery (0.31.0)
- google-cloud-core (0.28.1)
- google-resumable-media (0.3.1)
- googleapis-common-protos (1.5.3)
最新的包/文档怎么可能收到这个错误?
提前感谢您的帮助 问候
【问题讨论】:
标签: google-cloud-platform google-bigquery google-python-api