From 60fbf287b0d34d5db2e61cce7a5b42735ed43d0e Mon Sep 17 00:00:00 2001 From: Alan Yee Date: Fri, 19 Feb 2021 03:20:15 -0800 Subject: [PATCH] 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 --- samples/snippets/authenticate_service_account.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/samples/snippets/authenticate_service_account.py b/samples/snippets/authenticate_service_account.py index 58cd2b542..c07848bee 100644 --- a/samples/snippets/authenticate_service_account.py +++ b/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