mirror of
https://github.com/apache/superset.git
synced 2026-05-12 19:35:17 +00:00
fix(DB update): Gracefully handle querry error during DB update (#33250)
(cherry picked from commit de84a534ac)
This commit is contained in:
committed by
Michael S. Molina
parent
a6895e07b0
commit
f8b0632f99
@@ -437,6 +437,8 @@ class DatabricksNativeEngineSpec(DatabricksDynamicBaseEngineSpec):
|
||||
"""
|
||||
Return the default catalog.
|
||||
|
||||
It's optionally specified in `connect_args.catalog`. If not:
|
||||
|
||||
The default behavior for Databricks is confusing. When Unity Catalog is not
|
||||
enabled we have (the DB engine spec hasn't been tested with it enabled):
|
||||
|
||||
@@ -448,6 +450,10 @@ class DatabricksNativeEngineSpec(DatabricksDynamicBaseEngineSpec):
|
||||
To handle permissions correctly we use the result of `SHOW CATALOGS` when a
|
||||
single catalog is returned.
|
||||
"""
|
||||
connect_args = cls.get_extra_params(database)["engine_params"]["connect_args"]
|
||||
if default_catalog := connect_args.get("catalog"):
|
||||
return default_catalog
|
||||
|
||||
with database.get_sqla_engine() as engine:
|
||||
catalogs = {catalog for (catalog,) in engine.execute("SHOW CATALOGS")}
|
||||
if len(catalogs) == 1:
|
||||
|
||||
Reference in New Issue
Block a user