【发布时间】:2016-12-22 15:06:15
【问题描述】:
我有大型 csv 文件和 excel 文件,我在其中读取它们并根据其具有的字段和类型动态创建所需的创建表脚本。然后将数据插入到创建的表中。
我已阅读this 并了解我应该使用jobs.insert() 而不是tabledata.insertAll() 发送大量数据。
这就是我所说的(适用于较小的文件而不是较大的文件)。
result = client.push_rows(datasetname,table_name,insertObject) # insertObject is a list of dictionaries
当我使用库的 push_rows 时,它会在 Windows 中出现此错误。
[Errno 10054] An existing connection was forcibly closed by the remote host
这在 ubuntu 中。
[Errno 32] Broken pipe
所以当我查看BigQuery-Python 代码时,它使用table_data.insertAll()。
我怎样才能用这个库做到这一点?我知道我们可以通过 Google 存储上传,但我需要直接上传。
【问题讨论】:
标签: python python-2.7 google-bigquery large-data