我正在尝试将表从 google bigQuery 导出到 google 数据存储作为 json 文件。
运行这个 python 片段
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包版本
- 谷歌 api 核心 (1.1.0)
- 谷歌身份验证 (1.4.1)
- 谷歌云大查询(0.31.0)
- 谷歌云核心(0.28.1)
- 谷歌可恢复媒体 (0.3.1)
- googleapis-common-protos (1.5.3)
最新的软件包/文档怎么可能收到这个错误?
预先感谢您的帮助问候