Add Databricks SQL warehouse lifecycle operators#70088
Open
Vamsi-klu wants to merge 2 commits into
Open
Conversation
Contributor
Author
|
Local validation evidence for the Databricks SQL warehouse lifecycle implementation:
The tests assert the exact Databricks Warehouses API paths, idempotent start/stop behavior, transition-in-progress behavior, terminal failure states, templated-ID validation, and strict monotonic timeout handling. There are no UI changes in this PR, so screenshots would not add reviewer signal. No Databricks credentials were used: REST calls are mocked at the hook boundary, while the system-test Dag is import-validated. Live workspace execution can be added later if a reviewer specifically requests it. Drafted-by: Codex (GPT-5) |
Contributor
Author
|
@eladkal @moomindani Can i get some feedack/Stamp for the PR please? Thanks! |
A slow final status request can finish after the deadline even when it confirms the requested state. Treating that observation as a timeout can fail an otherwise successful Dag.
Vamsi-klu
marked this pull request as ready for review
July 19, 2026 07:01
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds first-class operators for starting and stopping existing Databricks SQL warehouses, including optional polling until the requested lifecycle state is reached.
related: #21377
Problem
Airflow's Databricks provider can execute SQL against a warehouse, but it has no first-class way to manage an existing warehouse's start/stop lifecycle. Dag authors currently need custom REST calls around their SQL tasks.
What changed
DatabricksHookmethods for retrieving, starting, and stopping a warehouse through the Databricks SQL Warehouses API.WarehouseStatemodel for the six documented lifecycle states.DatabricksStartWarehouseOperatorandDatabricksStopWarehouseOperatorwith idempotent pre-checks, optional waiting, monotonic deadlines, and explicit terminal-state errors.Warehouse IDs are embedded in the documented REST paths; no request-body workaround or new dependency is introduced. The implementation follows the Databricks SQL Warehouses API.
Scope
This is the Phase 1 scope proposed on #21377: get/state/start/stop plus synchronous waiting. Create/delete, edit, warehouse-by-name resolution, async hooks, and deferrable operators remain outside this PR so the initial contribution stays reviewable and independently useful.
Behavior and compatibility
RUNNINGwarehouse and stopping an alreadySTOPPEDwarehouse are no-ops.STARTING/STOPPINGtransitions are reused instead of issuing duplicate requests.STOPPINGcontinues polling; Databricks API transition rejections propagate unchanged.time.monotonic()and never accepts a target state observed after the configured deadline.common.compat.sdk.Validation
breeze run pytest providers/databricks/tests/unit/databricks/operators/test_databricks_warehouse.py -xvs— 21 passed.breeze testing providers-tests --test-type "Providers[databricks]"— 838 passed, 12 skipped.breeze testing providers-tests --test-type "Providers[amazon,common.compat,common.sql,databricks,google,openlineage]"— 11,858 passed, 185 skipped.breeze run mypy providers/databricks/src/airflow/providers/databricks/exceptions.py providers/databricks/src/airflow/providers/databricks/hooks/databricks.py providers/databricks/src/airflow/providers/databricks/operators/databricks_warehouse.py— success, no issues.prekpre-commit checks — passed.prekmanual checks — passed, including the providers mypy hook.breeze build-docs --docs-only --clean-build databricks— documentation build successful; the generated guide contains both lifecycle examples.breeze run pytest providers/databricks/tests/system/databricks/example_databricks_sql_warehouse.py --collect-only -q— 1 system test collected.breeze ci selective-check --commit-ref HEAD— selected provider unit/compatibility tests, provider mypy, docs, Python scans, and the system-test path; no UI tests selected.Reviewer evidence
This PR has no UI surface, so before/after screenshots and browser validation are not applicable. The REST boundary is covered with autospecced request assertions, operator behavior is covered with a specced hook, and the system example is import-validated. No Databricks workspace credentials were used or required for these deterministic lifecycle tests.
The narrow Phase 1 scope was posted on the issue before implementation: #21377 (comment)
Was generative AI tooling used to co-author this PR?
Generated-by: Codex (GPT-5) following the guidelines