From a76f57f8291a5e0c12d7aec708120e92e9453014 Mon Sep 17 00:00:00 2001 From: Tim Swast Date: Wed, 3 Nov 2021 17:02:22 -0500 Subject: [PATCH 1/2] docs: show gcloud command to authorize against sheets --- samples/query_external_sheets_permanent_table.py | 6 ++++++ samples/query_external_sheets_temporary_table.py | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/samples/query_external_sheets_permanent_table.py b/samples/query_external_sheets_permanent_table.py index 915e9acc3..a50ba229d 100644 --- a/samples/query_external_sheets_permanent_table.py +++ b/samples/query_external_sheets_permanent_table.py @@ -21,6 +21,12 @@ def query_external_sheets_permanent_table(dataset_id): # Create credentials with Drive & BigQuery API scopes. # Both APIs must be enabled for your project before running this code. + # + # If you are using credentials from gcloud, you must authorized the + # application first with the following command: + # + # gcloud auth application-default login \ + # --scopes=https://www.googleapis.com/auth/drive,https://www.googleapis.com/auth/cloud-platform credentials, project = google.auth.default( scopes=[ "https://www.googleapis.com/auth/drive", diff --git a/samples/query_external_sheets_temporary_table.py b/samples/query_external_sheets_temporary_table.py index 1b70e9531..fac04e254 100644 --- a/samples/query_external_sheets_temporary_table.py +++ b/samples/query_external_sheets_temporary_table.py @@ -22,10 +22,16 @@ def query_external_sheets_temporary_table(): # Create credentials with Drive & BigQuery API scopes. # Both APIs must be enabled for your project before running this code. + # + # If you are using credentials from gcloud, you must authorized the + # application first with the following command: + # + # gcloud auth application-default login \ + # --scopes=https://www.googleapis.com/auth/drive,https://www.googleapis.com/auth/cloud-platform credentials, project = google.auth.default( scopes=[ "https://www.googleapis.com/auth/drive", - "https://www.googleapis.com/auth/bigquery", + "https://www.googleapis.com/auth/cloud-platform", ] ) From 442c5567f330564324ca00566c13ff9e80a25d0d Mon Sep 17 00:00:00 2001 From: Tim Swast Date: Thu, 4 Nov 2021 06:38:37 -0500 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> --- samples/query_external_sheets_permanent_table.py | 2 +- samples/query_external_sheets_temporary_table.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/query_external_sheets_permanent_table.py b/samples/query_external_sheets_permanent_table.py index a50ba229d..31143d1b0 100644 --- a/samples/query_external_sheets_permanent_table.py +++ b/samples/query_external_sheets_permanent_table.py @@ -22,7 +22,7 @@ def query_external_sheets_permanent_table(dataset_id): # Create credentials with Drive & BigQuery API scopes. # Both APIs must be enabled for your project before running this code. # - # If you are using credentials from gcloud, you must authorized the + # If you are using credentials from gcloud, you must authorize the # application first with the following command: # # gcloud auth application-default login \ diff --git a/samples/query_external_sheets_temporary_table.py b/samples/query_external_sheets_temporary_table.py index fac04e254..a9d58e388 100644 --- a/samples/query_external_sheets_temporary_table.py +++ b/samples/query_external_sheets_temporary_table.py @@ -23,7 +23,7 @@ def query_external_sheets_temporary_table(): # Create credentials with Drive & BigQuery API scopes. # Both APIs must be enabled for your project before running this code. # - # If you are using credentials from gcloud, you must authorized the + # If you are using credentials from gcloud, you must authorize the # application first with the following command: # # gcloud auth application-default login \