From bd1cb96425dbdb27accf579f29f0ca968998eef8 Mon Sep 17 00:00:00 2001 From: Alan Yee Date: Wed, 10 Feb 2021 15:20:54 -0800 Subject: [PATCH 1/3] docs(bigquery): Add alternative approach to setting credentials --- 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..8b2d9e901 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 from a json string rather than read from a file + # 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 From e580ba87cf5ca436ea5b27392af639abd04f7f87 Mon Sep 17 00:00:00 2001 From: Alan Yee Date: Tue, 16 Feb 2021 22:06:19 -0800 Subject: [PATCH 2/3] docs(bigquery): Add alternative approach to setting credentials Correction: json object rather than string --- samples/snippets/authenticate_service_account.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/snippets/authenticate_service_account.py b/samples/snippets/authenticate_service_account.py index 8b2d9e901..6573640bc 100644 --- a/samples/snippets/authenticate_service_account.py +++ b/samples/snippets/authenticate_service_account.py @@ -31,7 +31,7 @@ def main(): ) # Alternatively, use service_account.Credentials.from_service_account_info() - # to set credentials from a json string rather than read from a file + # 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) From 49a74d3250b2b6a90c655193682639b5895513d3 Mon Sep 17 00:00:00 2001 From: Peter Lamut Date: Thu, 18 Feb 2021 19:50:59 +0100 Subject: [PATCH 3/3] Remove trailing space --- samples/snippets/authenticate_service_account.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/snippets/authenticate_service_account.py b/samples/snippets/authenticate_service_account.py index 6573640bc..c07848bee 100644 --- a/samples/snippets/authenticate_service_account.py +++ b/samples/snippets/authenticate_service_account.py @@ -30,7 +30,7 @@ def main(): key_path, scopes=["https://www.googleapis.com/auth/cloud-platform"], ) - # Alternatively, use service_account.Credentials.from_service_account_info() + # 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)