You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Respect user's default warehouse override in aitools (#4614)
## Why
The `aitools tools get-default-warehouse` command ignores the user's
default warehouse override (a per-user preference set via the SQL UI or
`databricks warehouses create-default-warehouse-override`). Users who
configured a preferred warehouse still get a different one.
Additionally, commands like `query` and `discover-schema` fail when the
resolved warehouse is stopped.
## Changes
Before: the command checked the `DATABRICKS_WAREHOUSE_ID` env var, then
fell through to server-side default detection (which does not
incorporate user overrides). Stopped warehouses were returned as-is.
Now:
- After the env var check, the command queries the user's default
warehouse override via
`GetDefaultWarehouseOverride("default-warehouse-overrides/me")`. If a
`CUSTOM` override exists with a valid, non-deleted warehouse, that
warehouse is used. All errors silently fall through to existing
behavior. `LAST_SELECTED` overrides are skipped since they require UI
state not available from the CLI.
- `GetWarehouseEndpoint` and `GetWarehouseID` accept an `autoStart`
parameter. When true, a stopped warehouse is started and the call blocks
until it reaches RUNNING. Enabled for `query` and `discover-schema`,
disabled for `get-default-warehouse` and `discover`.
New resolution priority:
1. `DATABRICKS_WAREHOUSE_ID` env var
2. User's default warehouse override (`CUSTOM` type only)
3. Server-side "default" warehouse
4. First usable warehouse by state
## Test plan
- [x] `make test-exp-aitools` passes (96 unit tests + 25 acceptance
tests)
- [x] Manual: `get-default-warehouse` returns existing default when no
override is set
- [x] Manual: set override with `create-default-warehouse-override me
CUSTOM --warehouse-id <id>`, verified `get-default-warehouse` returns
the overridden warehouse
- [x] Manual: deleted override, verified fallback to original behavior
0 commit comments