This is an automated email from the ASF dual-hosted git repository.
mobuchowski pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new e75e4436b6a feat: Add OpenLineage methods to DatabricksHook (#62179)
e75e4436b6a is described below
commit e75e4436b6a6549a2e22153e051dd9371230ab9e
Author: Kacper Muda <[email protected]>
AuthorDate: Mon Feb 23 14:34:28 2026 +0100
feat: Add OpenLineage methods to DatabricksHook (#62179)
---
.../providers/databricks/hooks/databricks.py | 26 ++++++++++++++++++++++
.../tests/unit/databricks/hooks/test_databricks.py | 12 ++++++++++
2 files changed, 38 insertions(+)
diff --git
a/providers/databricks/src/airflow/providers/databricks/hooks/databricks.py
b/providers/databricks/src/airflow/providers/databricks/hooks/databricks.py
index e7b273973f3..ff7e6150994 100644
--- a/providers/databricks/src/airflow/providers/databricks/hooks/databricks.py
+++ b/providers/databricks/src/airflow/providers/databricks/hooks/databricks.py
@@ -863,3 +863,29 @@ class DatabricksHook(BaseDatabricksHook):
message = str(e)
return status, message
+
+ def get_openlineage_database_info(self, _):
+ """Return Databricks-specific database info for OpenLineage namespace
resolution."""
+ from airflow.providers.openlineage.sqlparser import DatabaseInfo
+
+ port = f":{self.databricks_conn.port}" if self.databricks_conn.port
else ""
+
+ return DatabaseInfo(
+ scheme=self.get_openlineage_database_dialect(None),
+ authority=f"{self.host}{port}",
+ information_schema_columns=[
+ "table_schema",
+ "table_name",
+ "column_name",
+ "ordinal_position",
+ "data_type",
+ "table_catalog",
+ ],
+ is_information_schema_cross_db=True,
+ )
+
+ def get_openlineage_database_dialect(self, _) -> str:
+ return "databricks"
+
+ def get_openlineage_default_schema(self) -> str | None:
+ return "default"
diff --git
a/providers/databricks/tests/unit/databricks/hooks/test_databricks.py
b/providers/databricks/tests/unit/databricks/hooks/test_databricks.py
index 9f55a0e4370..aab9dff3751 100644
--- a/providers/databricks/tests/unit/databricks/hooks/test_databricks.py
+++ b/providers/databricks/tests/unit/databricks/hooks/test_databricks.py
@@ -1335,6 +1335,18 @@ class TestDatabricksHook:
timeout=self.hook.timeout_seconds,
)
+ def test_openlineage_methods(self):
+ from airflow.providers.openlineage.sqlparser import DatabaseInfo
+
+ db_info = self.hook.get_openlineage_database_info(None)
+ assert isinstance(db_info, DatabaseInfo)
+ assert db_info.scheme == "databricks"
+ assert db_info.authority == HOST
+ assert db_info.is_information_schema_cross_db is True
+
+ assert self.hook.get_openlineage_database_dialect(None) == "databricks"
+ assert self.hook.get_openlineage_default_schema() == "default"
+
@pytest.mark.db_test
class TestDatabricksHookToken: