Respect user's default warehouse override in aitools#4614
Merged
simonfaltum merged 4 commits intomainfrom Feb 27, 2026
Merged
Conversation
…house The aitools get-default-warehouse command now checks the user's default warehouse override (set via the SQL UI or CLI) before falling back to server-side default detection. Only CUSTOM overrides are used; LAST_SELECTED is skipped since it requires UI state. New priority order: 1. DATABRICKS_WAREHOUSE_ID env var 2. User's default warehouse override (CUSTOM type) 3. Server-side "default" warehouse 4. First usable warehouse by state
If the user's overridden warehouse is in DELETED or DELETING state, fall through to default detection instead of returning an unusable warehouse.
lennartkats-db
approved these changes
Feb 27, 2026
If the resolved warehouse is in STOPPED or STOPPING state, start it and wait for it to reach RUNNING before returning. This applies to all resolution paths (env var, user override, auto-detection). Extracts warehouse resolution into resolveWarehouse() for clarity.
GetWarehouseEndpoint and GetWarehouseID now accept an autoStart parameter. When true, a stopped warehouse is started and the call blocks until it reaches RUNNING state. Enabled for query and discover-schema (which need a running warehouse). Disabled for get-default-warehouse and discover (which only report warehouse info).
arsenyinfo
approved these changes
Feb 27, 2026
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.
Why
The
aitools tools get-default-warehousecommand ignores the user's default warehouse override (a per-user preference set via the SQL UI ordatabricks warehouses create-default-warehouse-override). Users who configured a preferred warehouse still get a different one. Additionally, commands likequeryanddiscover-schemafail when the resolved warehouse is stopped.Changes
Before: the command checked the
DATABRICKS_WAREHOUSE_IDenv var, then fell through to server-side default detection (which does not incorporate user overrides). Stopped warehouses were returned as-is.Now:
GetDefaultWarehouseOverride("default-warehouse-overrides/me"). If aCUSTOMoverride exists with a valid, non-deleted warehouse, that warehouse is used. All errors silently fall through to existing behavior.LAST_SELECTEDoverrides are skipped since they require UI state not available from the CLI.GetWarehouseEndpointandGetWarehouseIDaccept anautoStartparameter. When true, a stopped warehouse is started and the call blocks until it reaches RUNNING. Enabled forqueryanddiscover-schema, disabled forget-default-warehouseanddiscover.New resolution priority:
DATABRICKS_WAREHOUSE_IDenv varCUSTOMtype only)Test plan
make test-exp-aitoolspasses (96 unit tests + 25 acceptance tests)get-default-warehousereturns existing default when no override is setcreate-default-warehouse-override me CUSTOM --warehouse-id <id>, verifiedget-default-warehousereturns the overridden warehouse