Skip to content
This repository was archived by the owner on Sep 3, 2022. It is now read-only.

Commit acb9440

Browse files
committed
CREDENTIAL_SCOPES: Add /auth/drive for bigquery tables backed by sheets
- Allow service accounts to query bq tables backed by sheets - Without this scope you get the following 403 error from bq, where "globbing file pattern" appears to come from gdrive: ``` datalab.utils._http.RequestException: HTTP request failed (status 403): Access Denied: BigQuery BigQuery: Permission denied while globbing file pattern. ``` - Repro'ing is a bit complicated: - In gcp, make a "service account" - In gcp, create a "client id" for the service account - In gsuite, enable "domain-wide delegation" for the client id - Make a sheet - Share the sheet with the service account id (maybe not required?) - Make a bq table backed by the sheet - Query the table using the service account creds - Here's the most helpful reference I found: - https://stackoverflow.com/a/41676921/397334
1 parent bd9647f commit acb9440

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

datalab/context/_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
# that the user can define for themselves which scopes they want to use.
3030
CREDENTIAL_SCOPES = [
3131
'https://www.googleapis.com/auth/cloud-platform',
32+
'https://www.googleapis.com/auth/drive',
3233
]
3334

3435

google/datalab/utils/_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ def gcs_copy_file(source, dest):
138138
# that the user can define for themselves which scopes they want to use.
139139
CREDENTIAL_SCOPES = [
140140
'https://www.googleapis.com/auth/cloud-platform',
141+
'https://www.googleapis.com/auth/drive',
141142
]
142143

143144

0 commit comments

Comments
 (0)