pandas.read_gbq

pandas.read_gbq(query, project_id=None, index_col=None, col_order=None, reauth=False, auth_local_webserver=False, dialect=None, location=None, configuration=None, credentials=None, private_key=None, verbose=None) [source]

Load data from Google BigQuery.

This function requires the pandas-gbq package.

See the How to authenticate with Google BigQuery guide for authentication instructions.

Parameters:
query : str

SQL-Like Query to return data values.

project_id : str, optional

Google BigQuery Account project ID. Optional when available from the environment.

index_col : str, optional

Name of result column to use for index in results DataFrame.

col_order : list(str), optional

List of BigQuery column names in the desired order for results DataFrame.

reauth : boolean, default False

Force Google BigQuery to re-authenticate the user. This is useful if multiple accounts are used.

auth_local_webserver : boolean, default False

Use the local webserver flow instead of the console flow when getting user credentials.

New in version 0.2.0 of pandas-gbq.

dialect : str, default ‘legacy’

Note: The default value is changing to ‘standard’ in a future verion.

SQL syntax dialect to use. Value can be one of:

'legacy'

Use BigQuery’s legacy SQL dialect. For more information see BigQuery Legacy SQL Reference.

'standard'

Use BigQuery’s standard SQL, which is compliant with the SQL 2011 standard. For more information see BigQuery Standard SQL Reference.

Changed in version 0.24.0.

location : str, optional

Location where the query job should run. See the BigQuery locations documentation for a list of available locations. The location must match that of any datasets used in the query.

New in version 0.5.0 of pandas-gbq.

configuration : dict, optional

Query config parameters for job processing. For example:

configuration = {‘query’: {‘useQueryCache’: False}}

For more information see BigQuery REST API Reference.

credentials : google.auth.credentials.Credentials, optional

Credentials for accessing Google APIs. Use this parameter to override default credentials, such as to use Compute Engine google.auth.compute_engine.Credentials or Service Account google.oauth2.service_account.Credentials directly.

New in version 0.8.0 of pandas-gbq.

New in version 0.24.0.

private_key : str, deprecated

Deprecated in pandas-gbq version 0.8.0. Use the credentials parameter and google.oauth2.service_account.Credentials.from_service_account_info() or google.oauth2.service_account.Credentials.from_service_account_file() instead.

Service account private key in JSON format. Can be file path or string contents. This is useful for remote server authentication (eg. Jupyter/IPython notebook on remote host).

verbose : None, deprecated

Deprecated in pandas-gbq version 0.4.0. Use the logging module to adjust verbosity instead.

Returns:
df: DataFrame

DataFrame representing results of query.

See also

pandas_gbq.read_gbq
This function in the pandas-gbq library.
pandas.DataFrame.to_gbq
Write a DataFrame to Google BigQuery.

© 2008–2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/0.24.2/reference/api/pandas.read_gbq.html