This is an automated email from the ASF dual-hosted git repository.

beto pushed a commit to branch bigquery-list-catalogs-perms
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 32f59615acbb3dfaab610e2bd616c89b1cd35c50
Author: Beto Dealmeida <[email protected]>
AuthorDate: Tue Jan 14 10:14:41 2025 -0500

    fix(bigquery): return no catalogs when creds not set
---
 superset/db_engine_specs/bigquery.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/superset/db_engine_specs/bigquery.py 
b/superset/db_engine_specs/bigquery.py
index 74a5d151f1..4ef08eaa95 100644
--- a/superset/db_engine_specs/bigquery.py
+++ b/superset/db_engine_specs/bigquery.py
@@ -422,6 +422,11 @@ class BigQueryEngineSpec(BaseEngineSpec):  # pylint: 
disable=too-many-public-met
                 "Could not import libraries needed to connect to BigQuery."
             )
 
+        if not engine.dialect.credentials_info:
+            raise SupersetDBAPIConnectionError(
+                "The database credentials do not contain a 'credentials_info' 
field."
+            )
+
         credentials = service_account.Credentials.from_service_account_info(
             engine.dialect.credentials_info
         )
@@ -496,7 +501,12 @@ class BigQueryEngineSpec(BaseEngineSpec):  # pylint: 
disable=too-many-public-met
         """
         engine: Engine
         with database.get_sqla_engine() as engine:
-            client = cls._get_client(engine, database)
+            try:
+                client = cls._get_client(engine, database)
+            except SupersetDBAPIConnectionError:
+                # return {} here, since it will be repopulated when creds are 
added
+                return set()
+
             projects = client.list_projects()
 
         return {project.project_id for project in projects}

Reply via email to