我使用Python客户机库在googlebigquery中运行一个简单的SELECT
同步查询。我得到以下错误:
*** google.cloud.exceptions.Forbidden: 403 Response too large to return. Consider setting allowLargeResults to true
我使用run_sync_query()来达到这个目的。在
我的做法是(去掉不必要的东西):
def run_query(query_str):
from google.cloud import bigquery
client = biquery.Client()
query = client.run_sync_query(query_str)
query.run()
return query.fetch_data()
我知道在API documentation中有一个参数allowLargeResults
,但我不知道如何从客户端库设置该参数。在
您可以这样设置:
query.allow_large_results = True
https://github.com/GoogleCloudPlatform/google-cloud-python/blob/e716fbef3dc74e8853346426af356bad364f6637/bigquery/google/cloud/bigquery/job.py#L1090
但是,如果设置
allow_large_results
,则还必须指定要将结果写入的目标表:https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.query.allowLargeResults
相关问题 更多 >
编程相关推荐