【发布时间】:2021-08-10 14:01:55
【问题描述】:
我们正在使用 google bigquery 客户端库在 python 中从 BigQuery 导出到本地 JSON 文件:
from google.cloud import bigquery
import json
bq = bigquery.Client()
full_query = """
SELECT TO_JSON_STRING(t)
FROM (select * from bigquery-public-data.baseball.schedules) AS t
"""
query_rowiterator = bq.query(full_query).result() # rowIterator
在TO_JSON_STRING 中包装我们的查询会将输出转换为 JSON并维护类型 (BigQuery downloading or exporting as JSON does not respect types),这对于我们的表提取很重要。
如何尽快将queryjob_output 的输出转储到本地 JSON 文件中?
【问题讨论】:
标签: python json google-bigquery