Skip to content

BigQuery storage client error when downloading to pandas dataframe #10083

@YvesJacquot

Description

@YvesJacquot

Hi,

I am trying to download query results using the BigQuery client library, as per instructions on this page.

import google.auth
from google.cloud import bigquery
from google.cloud import bigquery_storage_v1beta1
# Make clients.
bqclient = bigquery.Client(
    credentials=credentials,
    project=your_project_id,
)
bqstorageclient = bigquery_storage_v1beta1.BigQueryStorageClient(
    credentials=credentials
)

# Download query results.
table_name = 'project.dataset.table'
query = f'''\
SELECT *
FROM   `{table_name}`
'''
dataframe = (
    bqclient.query(query)
    .result()
    .to_dataframe(bqstorage_client=bqstorageclient)
)
print(dataframe.shape)

I get the following error message.

File "/Users/**/anaconda3/lib/python3.7/site-packages/google/cloud/bigquery/_pandas_helpers.py", line 618, in _download_table_bqstorage
read_options = bigquery_storage_v1beta1.types.TableReadOptions()
AttributeError: 'NoneType' object has no attribute 'types'

Any idea how I could fix this?

I have the following config:

macOS High Sierra Version 10.13.6
Python 3.7.6.
google-cloud 0.34.0
google-cloud-bigquery 1.22.0
google-cloud-bigquery-storage 0.7.0

Many thanks

Metadata

Metadata

Assignees

Labels

api: bigquerystorageIssues related to the BigQuery Storage API.type: questionRequest for information or clarification. Not an issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions