【问题标题】:BigQuery v0.28 ChunkedEncodingError: ('Connection broken: IncompleteRead(46 bytes read)', IncompleteRead(46 bytes read))BigQuery v0.28 ChunkedEncodingError:('连接中断:IncompleteRead(46 字节读取)',IncompleteRead(46 字节读取))
【发布时间】:2018-02-12 19:38:39
【问题描述】:

我正在尝试将我们的 BigQuery 客户端库迁移到 0.28 版。现在,当我尝试获取表引用时,它以ChunkedEncodingError 失败。这是我的代码:

def table_exists(client, table_reference):
    from google.cloud.exceptions import NotFound

    try:
        client.get_table(table_reference)
        return True
    except NotFound:
        return False

我们使用的是 GAE 标准环境。这可能是请求库的问题吗?

【问题讨论】:

标签: google-app-engine google-bigquery


【解决方案1】:

google-cloud-bigquery 包与已部署的App Engine Standard 和Python 一起使用时,我遇到了同样的ChunkedEncodingError 错误。

这是 urllib3 与 Google App Engine 的问题。正如您在this link 中看到的:

...如果您使用的是标准环境,那么您要么必须使用 urllib3.contrib.appengine 的 AppEngineManager 要么使用 Sockets API

我使用了 Sockets API,它包括将以下内容添加到您的 app.yaml 文件中:

env_variables:
  GAE_USE_SOCKETS_HTTPLIB : 'true'

你有official google Sockets Python API docs here

之后,您可以重新部署,它应该可以工作。

还有 google-cloud-bigquery (0.30.0) 的最新版本,如果您不断遇到错误,请尝试使用该版本而不是 0.28.0。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-12-13
    • 2018-08-10
    • 2021-09-13
    • 2019-04-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-24
    相关资源
    最近更新 更多