8000 docs: pass credentials as python dictionary (#737) · googleapis/google-cloud-python@e970cf8 · GitHub
[go: up one dir, main page]

Skip to content

Commit e970cf8

Browse files
authored
docs: pass credentials as python dictionary (#737)
Document how to pass the credentials directly as dictionary/json instead of key json file path. Fixes #331 🦕
1 parent 697cb1c commit e970cf8

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

packages/sqlalchemy-bigquery/README.rst

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,27 @@ Project
104104
Authentication
105105
^^^^^^^^^^^^^^
106106

107-
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()``:
107+
Follow the `Google Cloud library guide <https://google-cloud-python.readthedocs.io/en/latest/core/auth.html>`_ for authentication.
108+
109+
Alternatively, you can choose either of the following approaches:
110+
111+
* provide the path to a service account JSON file in ``create_engine()`` using the ``credentials_path`` parameter:
108112

109113
.. code-block:: python
110114
115+
# provide the path to a service account JSON file
111116
engine = create_engine('bigquery://', credentials_path='/path/to/keyfile.json')
112117
118+
* pass the credentials in ``create_engine()`` as a Python dictionary using the ``credentials_info`` parameter:
119+
120+
.. code-block:: python
121+
122+
# provide credentials as a Python dictionary
123+
credentials_info = {
124+
"type": "service_account",
125+
"project_id": "your-service-account-project-id"
126+
},
127+
engine = create_engine('bigquery://', credentials_info=credentials_info)
113128
114129
Location
115130
^^^^^^^^

0 commit comments

Comments
 (0)
0