FrancescoCastaldi commented on code in PR #43695:
URL: https://github.com/apache/superset/pull/43695#discussion_r4267950249
##########
superset/db_engine_specs/databricks.py:
##########
@@ -1011,6 +1020,49 @@ def build_sqlalchemy_uri( # type: ignore
query=query,
).render_as_string(hide_password=False)
+ @classmethod
+ def adjust_engine_params(
+ cls,
+ uri: URL,
+ connect_args: dict[str, Any],
+ catalog: str | None = None,
+ schema: str | None = None,
+ ) -> tuple[URL, dict[str, Any]]:
+ adjusted_connect_args = connect_args.copy()
+
+ effective_catalog = (
+ catalog
+ or adjusted_connect_args.get("catalog")
+ or uri.query.get("catalog")
+ or cls.default_catalog
Review Comment:
Addressed in commit 6209589fc6629c0125d5bb26fc7c5e5b07c2c86c.
Removed `default_catalog = "hive_metastore"` from
`DatabricksNativeEngineSpec` and dropped the fallback in
`adjust_engine_params`. When no catalog is configured or passed, catalog
remains unset so the server default catalog (e.g. `main` or workspace default)
applies naturally, preventing handshake failures on servers without
multi-catalog support and preserving discovery in `get_default_catalog()`.
##########
superset/db_engine_specs/databricks.py:
##########
@@ -1011,6 +1020,49 @@ def build_sqlalchemy_uri( # type: ignore
query=query,
).render_as_string(hide_password=False)
+ @classmethod
+ def adjust_engine_params(
+ cls,
+ uri: URL,
+ connect_args: dict[str, Any],
+ catalog: str | None = None,
+ schema: str | None = None,
+ ) -> tuple[URL, dict[str, Any]]:
+ adjusted_connect_args = connect_args.copy()
+
+ effective_catalog = (
+ catalog
+ or adjusted_connect_args.get("catalog")
+ or uri.query.get("catalog")
+ or cls.default_catalog
+ )
+ effective_schema = (
+ schema
+ or adjusted_connect_args.get("schema")
+ or uri.query.get("schema")
Review Comment:
Addressed in commit 6209589fc6629c0125d5bb26fc7c5e5b07c2c86c.
Updated `adjust_engine_params` so the URI-database schema fallback
(`uri.database`) applies only when `catalog` is not being overridden. When
browsing another catalog (e.g. `catalog="main"` passed to
`get_all_schema_names`), the schema from the base URI is omitted so the initial
namespace handshake succeeds without requiring that schema to exist in the
target catalog.
Unit tests in `test_databricks.py` have been updated to assert both
behaviors.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]