Skip to content

Add --warehouse-id and fall through unusable SQL warehouses - #275

Merged
andy-xu-db merged 4 commits into
mainfrom
andy/usage-warehouse-override
Aug 7, 2026
Merged

Add --warehouse-id and fall through unusable SQL warehouses#275
andy-xu-db merged 4 commits into
mainfrom
andy/usage-warehouse-override

Conversation

@andy-xu-db

@andy-xu-db andy-xu-db commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Problem

ucode usage picks the first RUNNING SQL warehouse and aborts if it fails. On workspaces where a warehouse reports RUNNING but refuses connections, the command is unusable. For example:

• Using SQL warehouse ⚡ Reyden Warehouse (RUNNING).
ERROR Usage query failed: ENDPOINT_NOT_FOUND: SQL warehouse (…) does not exist at all in the database

There was no way to choose a different one. The error text told users to "pass --http-path", a flag that never existed.

Change

  • discover_sql_warehouses() returns all usable candidates, RUNNING first, instead of just one.
  • usage tries each in turn, warns on failure, and continues — so one bad warehouse no longer kills the report.
  • New --warehouse-id flag skips discovery entirely.

Testing

11 new unit tests; 1204 passed, ruff clean.

Verified on eng-ml-inference.staging, which has the broken warehouse above: auto-discovery now warns and falls through to a working one (exit 0, where main exits 1), and --warehouse-id pins directly.

@andy-xu-db
andy-xu-db marked this pull request as ready for review August 5, 2026 18:32
Comment thread src/ucode/usage.py
Comment thread src/ucode/cli.py
Comment thread src/ucode/databricks.py
Comment thread src/ucode/usage.py
AarushiShah-db
AarushiShah-db previously approved these changes Aug 6, 2026
AarushiShah-db
AarushiShah-db previously approved these changes Aug 6, 2026
AarushiShah-db
AarushiShah-db previously approved these changes Aug 7, 2026
@andy-xu-db
andy-xu-db merged commit ae3ad18 into main Aug 7, 2026
2 checks passed
@andy-xu-db
andy-xu-db deleted the andy/usage-warehouse-override branch August 7, 2026 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants