Skip to content

Commit a93b7d9

Browse files
dlstadthercpcloud
authored andcommitted
fix(bigquery): raise error if bigquery project id cannot be identified
1 parent 12bc4c0 commit a93b7d9

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

ibis/backends/bigquery/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,13 @@ def do_connect(
446446

447447
project_id = client_project_id or project_id or default_project_id
448448

449+
if project_id is None:
450+
raise ValueError(
451+
"Project ID could not be identified. "
452+
"Provide either explicit `project_id`, `client` with project, "
453+
"or don't provide an explicit `credentials` object."
454+
)
455+
449456
(
450457
self.data_project,
451458
self.billing_project,

ibis/backends/bigquery/tests/system/test_connect.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,3 +274,8 @@ def test_project_id_from_default(default_credentials):
274274
# `connect()` re-evaluates default credentials and sets project_id since no client nor explicit project_id is provided
275275
con = ibis.bigquery.connect()
276276
assert con.project_id == default_project_id
277+
278+
279+
def test_project_id_missing(credentials):
280+
with pytest.raises(ValueError, match="Project ID could not be identified.*"):
281+
ibis.bigquery.connect(credentials=credentials)

0 commit comments

Comments
 (0)