【发布时间】:2019-11-30 00:19:25
【问题描述】:
我正在尝试使用 Python API 将 Google Cloud Storage 中的 Cloud Firestore 导出加载到 Bigquery。我只需要加载几个我想使用 --projection_fields 参数的字段。但是,我无法在我的代码中成功使用此参数。我指的是这个文档:https://cloud.google.com/bigquery/docs/loading-data-cloud-firestore
我正在使用 google.cloud 库。
在 bigquery 或 firestore 库中找不到此字段。
任何有关如何使用 Python API 使用此字段的提示都会有很大帮助。
import os
from google.cloud import bigquery
creds_file_path = "xxxx.json"
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = creds_file_path
bigquery_client = bigquery.Client()
dataset_ref = bigquery_client.dataset('abcd')
job_config = bigquery.LoadJobConfig()
job_config.write_disposition = bigquery.WriteDisposition.WRITE_TRUNCATE
job_config.source_format = bigquery.SourceFormat.DATASTORE_BACKUP
【问题讨论】:
-
你最终设法让它工作了吗?
标签: python google-cloud-firestore google-bigquery