Skip to content

Commit

Permalink
docs: pass credentials as python dictionary (#737)
Browse files Browse the repository at this point in the history
Document how to pass the credentials directly as dictionary/json instead of key json file path.

Fixes #331  🦕
  • Loading branch information
alvarowolfx authored Feb 9, 2023
1 parent 8e9aa89 commit 074321d
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,27 @@ Project
Authentication
^^^^^^^^^^^^^^

Follow the `Google Cloud library guide <https://google-cloud-python.readthedocs.io/en/latest/core/auth.html>`_ for authentication. Alternatively, you can provide the path to a service account JSON file in ``create_engine()``:
Follow the `Google Cloud library guide <https://google-cloud-python.readthedocs.io/en/latest/core/auth.html>`_ for authentication.

Alternatively, you can choose either of the following approaches:

* provide the path to a service account JSON file in ``create_engine()`` using the ``credentials_path`` parameter:

.. code-block:: python
# provide the path to a service account JSON file
engine = create_engine('bigquery://', credentials_path='/path/to/keyfile.json')
* pass the credentials in ``create_engine()`` as a Python dictionary using the ``credentials_info`` parameter:

.. code-block:: python
# provide credentials as a Python dictionary
credentials_info = {
"type": "service_account",
"project_id": "your-service-account-project-id"
},
engine = create_engine('bigquery://', credentials_info=credentials_info)
Location
^^^^^^^^
Expand Down

0 comments on commit 074321d

Please sign in to comment.