Skip to content

Commit

Permalink
docs(bigquery): Add alternative approach to setting credentials (#517)
Browse files Browse the repository at this point in the history
* 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 authored Feb 19, 2021
1 parent 1862de7 commit 60fbf28
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions samples/snippets/authenticate_service_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 60fbf28

Please sign in to comment.