将数据帧上载到Google BigQuery时保持一致(10054,WSAERROR)

2024-10-02 10:34:32 发布

您现在位置:Python中文网/ 问答频道 /正文

运行此代码时遇到问题。几周前,它对一组约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)

我试图调节chunksize,但这只是延迟了WSAERROR的发生,并没有阻止它。我的研究表明,这可能是标题的问题,但如何将标题更改为_gbq

这是最近的追踪。如果需要,我可以提供完整的,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')

谢谢你的帮助


Tags: theinimportselfsslhomelibonedrive

热门问题