【发布时间】:2022-11-18 18:04:05
【问题描述】:
我正在编写一个小的 python 脚本,用于将从 API 获取的数据写入 BigQuery 表。我只有少量数据。来自 API 的数据每天更新。我希望能够每天用最新的数据覆盖表目标。
我在云函数中有以下脚本:
data = {'col': 'value'} # the JSON response I get from the API (simplified output)
job_config = bigquery.LoadJobConfig(
schema = [
bigquery.SchemaField("col", "STRING"),
],
write_disposition="WRITE_TRUNCATE",
)
job = bq_client.insert_rows_json(table_id, [data], job_config=job_config)
和以下错误Client.insert_rows_json() got an unexpected keyword argument 'job_config'
我应该使用不同于insert_rows_json()的方法吗?每天在同一张表中写入这些新数据的最佳方式是什么?
【问题讨论】:
标签: json python-3.x google-bigquery