Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(databricks): keep a stopped-warehouse error retryable (#115583)

Tom Owersc5c3c2aafd10
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/databricks/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/databricks/source.py
index 85c493e86dfc..ef20ba8cbb47 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/databricks/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/databricks/source.py
@@ -201,6 +201,13 @@ class DatabricksSource(SQLSource[DatabricksSourceConfig], ValidateDatabaseHostMi
"[FAILED_JDBC.CONNECTION]": "Databricks couldn't connect to a federated database backing a table you're syncing (a Lakehouse Federation connection). Check that the underlying database is reachable and its connection details in Databricks are still correct, then resync.",
}
+ def get_retryable_errors(self) -> set[str]:
+ # Raised when the SQL warehouse auto-suspended (or was manually stopped) while a
+ # command was in flight. Databricks auto-starts a stopped warehouse on the next query
+ # by default, so the fresh connection Temporal opens on its next retry attempt usually
+ # finds the warehouse running again.
+ return {"was stopped."}
+
def get_schemas(
self,
config: DatabricksSourceConfig,
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/databricks/tests/test_databricks.py b/products/warehouse_sources/backend/temporal/data_imports/sources/databricks/tests/test_databricks.py
index b5e5ba6e9ed4..bef896178d56 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/databricks/tests/test_databricks.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/databricks/tests/test_databricks.py
@@ -415,6 +415,13 @@ class TestDatabricksSource:
assert message == "Host is not allowed"
mock_get_schemas.assert_not_called()
+ def test_get_retryable_errors_matches_stopped_warehouse(self, source):
+ # A command in flight when the SQL warehouse auto-suspends fails with this message;
+ # Databricks auto-starts the warehouse on the next query, so it must stay retryable
+ # rather than disabling the source.
+ observed_error = "Command failed because warehouse abc123 was stopped."
+ assert any(key in observed_error for key in source.get_retryable_errors())
+
class TestGetSchemasDeadline:
def test_discovery_that_hangs_raises_before_the_activity_timeout(self, mocker):