在Python中使用存储在JSON文件中的架构

问题描述 投票:0回答:2

关于Google文档,我可以按以下方式使用存储在命令行中JSON文件中的架构:

bq --location=location load \
--source_format=format \
project_id:dataset.table \
path_to_data_file \
path_to_schema_file

其中path_to_schema_file是包含架构的文件的路径

是否有办法在python中执行此操作,并将架构从json文件传递到LoadJobConfig().schema?还是我应该手动读取模式并将其转换为bigquery.TableSchema()对象?

python google-bigquery
2个回答
1
投票

schema_from_json()似乎是what you're looking for


0
投票

您是否尝试使用模式初始化LoadJobConfig

© www.soinside.com 2019 - 2024. All rights reserved.