You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Python的BigQuery Client:超时与轮询问题

问题解决:BigQuery result() 方法抛出 TypeError: _blocking_poll() got an unexpected keyword argument 'retry'

问题原因

该错误源于google-cloud-bigquery 与 google-api-core 版本不兼容。新版本的google-cloud-bigquery在调用result()时会传递retry参数,但旧版本google-api-core的_blocking_poll()方法不支持该参数,从而触发类型错误。

解决方案

  • 统一更新依赖版本
    直接升级两个依赖到兼容版本,执行以下命令:

    pip install --upgrade google-cloud-bigquery google-api-core
    

    若需要固定版本避免后续兼容问题,可指定经测试的兼容版本组合,例如:

    pip install google-cloud-bigquery==3.12.0 google-api-core==2.11.1
    
  • 显式禁用retry参数传递
    在调用result()时,主动传入retry=None,阻止上层将该参数传递到不兼容的底层方法:

    query_job = client.query(QUERY)  # API request to start the query
    # 显式指定retry=None,同时可自定义timeout时长
    db_rslt = query_job.result(retry=None, timeout=300)
    
  • conda环境下的依赖调整
    先查看当前依赖版本:

    conda list | grep -E "google-cloud-bigquery|google-api-core"
    

    再通过conda更新到兼容版本:

    conda install -c conda-forge google-cloud-bigquery google-api-core
    

内容的提问来源于stack exchange,提问作者Mohan_2523

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.09 18:35:20