Skip to content
Permalink
Browse files
docs(bigquery): Add alternative approach to setting credentials (#517)
* docs(bigquery): Add alternative approach to setting credentials

* docs(bigquery): Add alternative approach to setting credentials

Correction: json object rather than string

* Remove trailing space

Co-authored-by: Peter Lamut <plamut@users.noreply.github.com>
  • Loading branch information
alanyee and plamut committed Feb 19, 2021
1 parent 1862de7 commit 60fbf287b0d34d5db2e61cce7a5b42735ed43d0e
Showing with 5 additions and 0 deletions.
  1. +5 −0 samples/snippets/authenticate_service_account.py
@@ -30,6 +30,11 @@ def main():
key_path, scopes=["https://www.googleapis.com/auth/cloud-platform"],
)

# Alternatively, use service_account.Credentials.from_service_account_info()
# to set credentials directly via a json object rather than set a filepath
# TODO(developer): Set key_json to the content of the service account key file.
# credentials = service_account.Credentials.from_service_account_info(key_json)

client = bigquery.Client(credentials=credentials, project=credentials.project_id,)
# [END bigquery_client_json_credentials]
return client

0 comments on commit 60fbf28

Please sign in to comment.