首页 > 解决方案 > 具有大结果的 Pandas read_gbq

问题描述

我正在尝试从 Google bigquery 公共数据集中获取数据并将结果存储在 pandas 数据框中。当我添加 LIMIT 100 之类的内容时,我的代码运行良好,但是当我尝试在没有它的情况下运行时出现错误。理想情况下,我想从公共数据集中检索所有行,将它们存储在 pandas 数据框中,并在 Python 中使用它,而不是在谷歌云或 SQL 中使用。这是我当前的代码和错误消息。

import pandas as pd

process_date = '2021-08-16'
process_date_no_dash = '20210816'
project_id = 'myproject-323109'

query = '''
        SELECT * 
        FROM `bigquery-public-data.crypto_bitcoin.transactions`
        
'''

df_bit = pd.read_gbq(query, project_id = project_id, dialect = 'standard', configuration={"allow_large_results":True})

GenericGBQException: Reason: 403 Response too large to return. Consider specifying a destination table in your job configuration. For more details, see https://cloud.google.com/bigquery/troubleshooting-errors

如何修复此错误?

标签: python-3.xpandasgoogle-bigquery

解决方案


推荐阅读