【发布时间】:2017-12-03 22:17:07
【问题描述】:
我有一个 Python 脚本,它正在从 firebase 下载数据,对其进行操作,然后将其转储到 JSON 文件中。我可以通过命令行将其上传到 BigQuery,但现在我想将一些代码放入 Python 脚本中,以便将其全部完成。
这是我目前的代码。
import json
from firebase import firebase
firebase = firebase.FirebaseApplication('<redacted>')
result = firebase.get('/connection_info', None)
id_keys = map(str, result.keys())
#with open('result.json', 'r') as w:
# connection = json.load(w)
with open("w.json", "w") as outfile:
for id in id_keys:
json.dump(result[id], outfile, indent=None)
outfile.write("\n")
【问题讨论】:
-
另外,当我从命令行手动将文件上传到 BiqQuery 时,我首先必须将 json 上传到我的谷歌云。有没有办法让它自动化?
标签: python json upload export google-bigquery