Skip to content

ENH: gbq docs update #12345

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions doc/source/io.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4153,7 +4153,7 @@ to existing tables.
.. warning::

To use this module, you will need a valid BigQuery account. Refer to the
`BigQuery Documentation <https://developers.google.com/bigquery/>`__ for details on the service itself.
`BigQuery Documentation <https://cloud.google.com/bigquery/what-is-bigquery>`__ for details on the service itself.

The key functions are:

Expand All @@ -4173,17 +4173,18 @@ The key functions are:

Authentication
''''''''''''''

Authentication is possible with either user account credentials or service account credentials.
Authentication to the Google ``BigQuery`` service is via ``OAuth 2.0``.
Is possible to authenticate with either user account credentials or service account credentials.

Authenticating with user account credentials is as simple as following the prompts in a browser window
which will be automatically opened for you. You will be authenticated to the specified
``BigQuery`` account via Google's ``Oauth2`` mechanism. Additional information on the
authentication mechanism can be found `here <https://developers.google.com/identity/protocols/OAuth2#clientside/>`__.
``BigQuery`` account using the product name ``pandas GBQ``. It is only possible on local host.
The remote authentication using user account credentials is not currently supported in Pandas.
Additional information on the authentication mechanism can be found
`here <https://developers.google.com/identity/protocols/OAuth2#clientside/>`__.

Authentication with service account credentials is possible via the `'private_key'` parameter. This method
is particularly useful when working on remote servers (eg. jupyter iPython notebook on remote host).
The remote authentication using user account credentials is not currently supported in Pandas.
Additional information on service accounts can be found
`here <https://developers.google.com/identity/protocols/OAuth2#serviceaccount>`__.

Expand Down Expand Up @@ -4314,13 +4315,13 @@ For example:
.. note::

The BigQuery SQL query language has some oddities, see the
`BigQuery Query Reference Documentation <https://developers.google.com/bigquery/query-reference>`__.
`BigQuery Query Reference Documentation <https://cloud.google.com/bigquery/query-reference>`__.

.. note::

While BigQuery uses SQL-like syntax, it has some important differences from traditional
databases both in functionality, API limitations (size and quantity of queries or uploads),
and how Google charges for use of the service. You should refer to `Google BigQuery documentation <https://developers.google.com/bigquery/>`__
and how Google charges for use of the service. You should refer to `Google BigQuery documentation <https://cloud.google.com/bigquery/what-is-bigquery>`__
often as the service seems to be changing and evolving. BiqQuery is best for analyzing large
sets of data quickly, but it is not a direct replacement for a transactional database.

Expand Down
31 changes: 25 additions & 6 deletions pandas/io/gbq.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,12 +525,18 @@ def read_gbq(query, project_id=None, index_col=None, col_order=None,

THIS IS AN EXPERIMENTAL LIBRARY

The main method a user calls to execute a Query in Google BigQuery and read
results into a pandas DataFrame using the v2 Google API client for Python.
Documentation for the API is available at
https://developers.google.com/api-client-library/python/. Authentication
to the Google BigQuery service is via OAuth 2.0 using the product name
'pandas GBQ'.
The main method a user calls to execute a Query in Google BigQuery
and read results into a pandas DataFrame.

Google BigQuery API Client Library v2 for Python is used.
Documentation is available at
https://developers.google.com/api-client-library/python/apis/bigquery/v2

Authentication to the Google BigQuery service is via OAuth 2.0.
By default user account credentials are used. You will be asked to
grant permissions for product name 'pandas GBQ'. It is also posible
to authenticate via service account credentials by using
private_key parameter.

Parameters
----------
Expand Down Expand Up @@ -615,6 +621,19 @@ def to_gbq(dataframe, destination_table, project_id, chunksize=10000,

THIS IS AN EXPERIMENTAL LIBRARY

The main method a user calls to export pandas DataFrame contents to
Google BigQuery table.

Google BigQuery API Client Library v2 for Python is used.
Documentation is available at
https://developers.google.com/api-client-library/python/apis/bigquery/v2

Authentication to the Google BigQuery service is via OAuth 2.0.
By default user account credentials are used. You will be asked to
grant permissions for product name 'pandas GBQ'. It is also posible
to authenticate via service account credentials by using
private_key parameter.

Parameters
----------
dataframe : DataFrame
Expand Down