python - 将数据帧上传到 Google BigQuery 时一致(10054,WSAERROR)
问题描述
我在运行此代码时遇到问题。几周前它对一组约 160 个数据帧执行良好,但最近,Google BigQuery 在尝试运行代码时开始抛出 WSAERROR。
import glob
import pandas as pd
import os
import pandas_gbq as pd_gbq
import time
import tqdm
from google.cloud import bigquery, exceptions
for file in glob.glob(stage_folder)[:34]:
df = pd.read_csv(file)
pd_gbq.to_gbq(df, output_table, project_id = project_id, progress_bar= True, if_exists='append', chunksize = 330000)
print('Sleeping...')
time.sleep(300)
我试图调整块大小,但这只是延迟了 WSAERROR 的发生,并没有阻止它。我的研究表明这可能是标题的问题,但是如何更改 to_gbq 中的标题?
这是最新的 Traceback。如果需要,我可以提供完整的,Stack 只是将完整的回溯解释为垃圾邮件。
---------------------------------------------------------------------------
SysCallError Traceback (most recent call last)
~\OneDrive - The Home Depot\Documents\anaconda3\lib\site-packages\urllib3\contrib\pyopenssl.py in _send_until_done(self, data)
316 try:
--> 317 return self.connection.send(data)
318 except OpenSSL.SSL.WantWriteError:
~\OneDrive - The Home Depot\Documents\anaconda3\lib\site-packages\OpenSSL\SSL.py in send(self, buf, flags)
1736 result = _lib.SSL_write(self._ssl, buf, len(buf))
-> 1737 self._raise_ssl_error(self._ssl, result)
1738 return result
~\OneDrive - The Home Depot\Documents\anaconda3\lib\site-packages\OpenSSL\SSL.py in _raise_ssl_error(self, ssl, result)
1638 if errno != 0:
-> 1639 raise SysCallError(errno, errorcode.get(errno))
1640 raise SysCallError(-1, "Unexpected EOF")
SysCallError: (10054, 'WSAECONNRESET')
谢谢你的帮助!
解决方案
推荐阅读
- python - Python字典:迭代字典的不同方式
- laravel - 基于列值的 Foreach 内部的 Foreach
- reactjs - 反应本机按钮不适合屏幕
- reactjs - React Spring Simple Transition - Transform3d 和不透明度在转换时不完全为 0
- javascript - 我如何将strapi作为CMS集成到我的网站中,这意味着我不希望所有后端都使用strapi构建,
- docusaurus - 使用 Docusaurus v2 的选项卡中的 Markdown 内容
- typescript - 引用由 sequelize typescript + PostgreSQL 中的两个主键定义的表
- angular - 使用不同的参数值加载Angular页面时多次加载
- angular - FabricJS - 将对象剪辑到角度 js 中的边界框
- python-3.x - 如何使用 ManyToMany 字段 django 展示数量?