Skip to content

Commit 9594940

Browse files
Validate Notebook User Email request (#1307)
1 parent 2ae4d71 commit 9594940

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
kind: Under the Hood
2+
body: Validate notebooks authorization request has succeeded
3+
time: 2025-09-02T10:10:29.143638-07:00
4+
custom:
5+
Author: colin-rogers-dbt
6+
Issue: "1307"

dbt-bigquery/src/dbt/adapters/bigquery/python_submissions.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,16 @@ def _config_notebook_job(
332332
url="https://www.googleapis.com/oauth2/v2/userinfo",
333333
headers={"Authorization": f"Bearer {self._GoogleCredentials.token}"},
334334
)
335-
notebook_execution_job.execution_user = json.loads(response.data).get("email")
335+
if response.status != 200:
336+
raise DbtRuntimeError(
337+
f"Failed to retrieve user info. Status: {response.status}, Body: {response.data}"
338+
)
339+
if user_email := json.loads(response.data).get("email"):
340+
notebook_execution_job.execution_user = user_email
341+
else:
342+
raise DbtRuntimeError(
343+
"Authorization request to get user failed to return an email."
344+
)
336345
else:
337346
raise ValueError(
338347
f"Unsupported credential method in BigFrames: '{self._connection_method}'"

0 commit comments

Comments
 (0)