Pandas 无法使用Python连接到BigQuery-ServiceUnavailable

Pandas 无法使用Python连接到BigQuery-ServiceUnavailable,pandas,google-bigquery,Pandas,Google Bigquery,从BigQuery查询数据对我来说很有用。然后我更新了我的谷歌软件包(例如谷歌云bigquery),突然我无法再下载数据了。不幸的是,我不知道我正在使用的软件包的旧版本。现在,我正在使用google cloud bigquery的“1.26.1”版本 以下是我正在运行的代码: from google.cloud import bigquery from google.oauth2 import service_account import pandas as pd KEY_FILE_LOCAT

从BigQuery查询数据对我来说很有用。然后我更新了我的谷歌软件包(例如谷歌云bigquery),突然我无法再下载数据了。不幸的是,我不知道我正在使用的软件包的旧版本。现在,我正在使用google cloud bigquery的“1.26.1”版本

以下是我正在运行的代码:

from google.cloud import bigquery
from google.oauth2 import service_account
import pandas as pd

KEY_FILE_LOCATION = "path_to_json"
PROCECT_ID = 'bigquery-123454'

credentials = service_account.Credentials.from_service_account_file(KEY_FILE_LOCATION)
client = bigquery.Client(credentials= credentials,project=PROCECT_ID)

query_job = client.query("""
SELECT
x,
y
FROM
`bigquery-123454.624526435.ga_sessions_*` 
WHERE
_TABLE_SUFFIX BETWEEN '20200501' AND '20200502' 
""")

results = query_job.result()

df = results.to_dataframe()
除了最后一行
df=results.to_dataframe()
代码工作正常。现在我得到一个由三部分组成的错误:

第1部分:

_InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
    status = StatusCode.UNAVAILABLE
    details = "failed to connect to all addresses"
    debug_error_string = "{"created":"@1596627109.629000000","description":"Failed to pick subchannel","file":"src/core/ext/filters/client_channel/client_channel.cc","file_line":3948,"referenced_errors":[{"created":"@1596627109.629000000","description":"failed to connect to all addresses","file":"src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc","file_line":394,"grpc_status":14}]}"
>
第3部分:

RetryError: Deadline of 600.0s exceeded while calling functools.partial(<function _wrap_unary_errors.<locals>.error_remapped_callable at 0x0000000010BD3C80>, table_reference {
  project_id: "bigquery-123454"
  dataset_id: "_a0003e6c1ab4h23rfaf0d9cf49ac0e90083ca349e"
  table_id: "anon2d0jth_f891_40f5_8c63_76e21ab5b6f5"
}
requested_streams: 1
read_options {
}
format: ARROW
parent: "projects/bigquery-123454"
, metadata=[('x-goog-request-params', 'table_reference.project_id=bigquery-123454&table_reference.dataset_id=_a0003e6c1abanaw4egacf0d9cf49ac0e90083ca349e'), ('x-goog-api-client', 'gl-python/3.7.3 grpc/1.30.0 gax/1.22.0 gapic/1.0.0')]), last exception: 503 failed to connect to all addresses
RetryError:调用functools.partial(,表_引用)时超过了600.0s的截止日期{
项目编号:“bigquery-123454”
数据集id:“\u a0003e6c1ab4h23rfaf0d9cf49ac0e90083ca349e”
表id:“anon2d0jth\U f891\U 40f5\U 8c63\U 76e21ab5b6f5”
}
请求的_流:1
阅读选项{
}
格式:箭头
父项:“项目/bigquery-123454”
,元数据=[('x-goog-request-params','x-goog-api-client','gl python/3.7.3 grpc/1.30.0 gax/1.22.0 gapic/1.0.0')),最后一个异常:503未能连接到所有地址
我无法解释这个错误。我认为这与我更新软件包无关

我曾经遇到代理问题,但这些问题导致了另一个/不同的错误

我的同事说“bigquery-123454”项目在bigquery中仍然可用

有什么想法吗


提前谢谢你的帮助

503出现网络问题时发生错误。一段时间后重试或重试作业。

您可以在

503上阅读有关错误的更多信息。当出现网络问题时,会发生错误。一段时间后重试或重试作业。
您可以在

上阅读有关错误的更多信息。我找到了答案: 在将包“google cloud bigquery”从1.26.1版本降级到1.18.1版本后,代码再次工作!因此,新包导致了错误。 我使用
pip install google cloud bigquery==1.18.1——强制重新安装

对软件包进行了降级,我找到了答案: 在将包“google cloud bigquery”从1.26.1版本降级到1.18.1版本后,代码再次工作!因此,新包导致了错误。 我使用
pip安装googlecloudbigquery==1.18.1——强制重新安装

RetryError: Deadline of 600.0s exceeded while calling functools.partial(<function _wrap_unary_errors.<locals>.error_remapped_callable at 0x0000000010BD3C80>, table_reference {
  project_id: "bigquery-123454"
  dataset_id: "_a0003e6c1ab4h23rfaf0d9cf49ac0e90083ca349e"
  table_id: "anon2d0jth_f891_40f5_8c63_76e21ab5b6f5"
}
requested_streams: 1
read_options {
}
format: ARROW
parent: "projects/bigquery-123454"
, metadata=[('x-goog-request-params', 'table_reference.project_id=bigquery-123454&table_reference.dataset_id=_a0003e6c1abanaw4egacf0d9cf49ac0e90083ca349e'), ('x-goog-api-client', 'gl-python/3.7.3 grpc/1.30.0 gax/1.22.0 gapic/1.0.0')]), last exception: 503 failed to connect to all addresses