Skip to content

Commit 76b73d6

Browse files
committed
feat(config): select default warehouses per command group
Snowflake targets can set [targets.<name>.warehouses] build and query warehouses, overridable per invocation with --warehouse. Every CLI command is classified into the build or query group in one table, so a command never mixes warehouses. sqb debug and the verbose build header report the resolved warehouse and its source. Adapters without a session warehouse reject the settings.
1 parent f16a20a commit 76b73d6

72 files changed

Lines changed: 2388 additions & 25 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎src/sqlbuild/.agents/skills/sqlbuild/references/docs/cli/audit.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ sqb --project-dir <path> audit [flags]
2626
| `--concurrency` | Maximum number of audits to run concurrently (default: `1`) |
2727
| `--json` | Print structured audit results |
2828
| `--json-output` | Write structured audit results to a file |
29+
| `--warehouse <name>` | Snowflake warehouse for this invocation; overrides the target's `build` [warehouse group](../concepts/project-configuration.md#command-group-warehouses) and the connection warehouse |
2930

3031
## Concurrency
3132

‎src/sqlbuild/.agents/skills/sqlbuild/references/docs/cli/build.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ sqb --project-dir <path> build [flags]
5454
| `--manifest` | Generate `target/manifest.json` with plan-aware project metadata |
5555
| `--select`, `-s` | Select specific models |
5656
| `--exclude` | Exclude specific models |
57+
| `--warehouse <name>` | Snowflake warehouse for this invocation; overrides the target's `build` [warehouse group](../concepts/project-configuration.md#command-group-warehouses) and the connection warehouse |
5758

5859
## Fast iteration
5960

‎src/sqlbuild/.agents/skills/sqlbuild/references/docs/cli/check.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ sqb --project-dir <path> check [flags]
2424
| `--json` | Print check results as JSON |
2525
| `--json-output` | Write check results JSON to a file path |
2626
| `--vars` | Override project variables |
27+
| `--warehouse <name>` | Snowflake warehouse for this invocation; overrides the target's `build` [warehouse group](../concepts/project-configuration.md#command-group-warehouses) and the connection warehouse |
2728

2829
Selecting a non-check node is rejected; use [`sqb build`](build.md) to run tasks and assets.
2930

‎src/sqlbuild/.agents/skills/sqlbuild/references/docs/cli/clone.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ sqb --project-dir <path> clone --from <target> [--to <target>] [flags]
3636
| `--no-sql-analysis` | Disable compile-time SQL analysis (`--no-sql-validation` is an alias) |
3737
| `--select`, `-s` | Select specific models to clone |
3838
| `--exclude` | Exclude specific models from cloning |
39+
| `--warehouse <name>` | Snowflake warehouse for this invocation; overrides the target's `build` [warehouse group](../concepts/project-configuration.md#command-group-warehouses) and the connection warehouse |
3940

4041
## Examples
4142

‎src/sqlbuild/.agents/skills/sqlbuild/references/docs/cli/contract.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ replace conflicts rather than preserving authored declarations.
3737
| `--vars` | both | Override project variables |
3838
| `--write` | generate | Apply generated repository changes |
3939
| `--overwrite` | generate | Replace conflicting declarations; requires `--write` |
40+
| `--warehouse <name>` | both | Snowflake warehouse for this invocation; overrides the target's `query` [warehouse group](../concepts/project-configuration.md#command-group-warehouses) and the connection warehouse |
4041

4142
See [Contracts](../concepts/models/contracts.md#adopting-an-existing-schema) for ownership and safety
4243
guarantees.

‎src/sqlbuild/.agents/skills/sqlbuild/references/docs/cli/dbt.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,8 @@ target_path = "../dbt_project/target"
9191
```
9292

9393
See [Project Configuration](../concepts/project-configuration.md#dbt) for all fields.
94+
95+
SQLBuild-owned work in `sqb dbt plan`, `run` and `build` connects with the target's `build`
96+
[warehouse group](../concepts/project-configuration.md#command-group-warehouses). dbt itself
97+
keeps using the warehouse from its profile. These commands do not accept `--warehouse`, because
98+
their remaining arguments pass through to dbt.

‎src/sqlbuild/.agents/skills/sqlbuild/references/docs/cli/debug.md‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,17 @@ The command runs three groups of checks:
2020

2121
**Runtime** - SQLBuild version, Python version, Python path, OS info.
2222

23-
**Configuration** - Finds and validates `sqlbuild_project.toml`, loads `sqlbuild_local.toml` if present, resolves the adapter and active target.
23+
**Configuration** - Finds and validates `sqlbuild_project.toml`, loads `sqlbuild_local.toml` if present, resolves the adapter and active target. For Snowflake it also shows the warehouse each [command group](../concepts/project-configuration.md#command-group-warehouses) connects with and where that value came from.
2424

25-
**Connection** - Displays connection settings (secrets are masked), attempts to connect to the warehouse, and runs `SELECT 1` to verify query execution.
25+
**Connection** - Displays connection settings as `sqb debug` itself uses them, with the `query` warehouse group applied (secrets are masked), attempts to connect to the warehouse, and runs `SELECT 1` to verify query execution.
2626

2727
## Flags
2828

2929
| Flag | Description |
3030
|------|-------------|
3131
| `--no-connection` | Skip the connection and query tests. Useful for validating config without warehouse access. |
3232
| `--json` | Output results as JSON instead of formatted text. |
33+
| `--warehouse <name>` | Snowflake warehouse for this invocation; overrides the target's `query` [warehouse group](../concepts/project-configuration.md#command-group-warehouses) and the connection warehouse |
3334

3435
## Example
3536

@@ -52,6 +53,8 @@ Configuration:
5253
project: waffle_shop [OK loaded]
5354
adapter: snowflake [OK found]
5455
target: dev [OK resolved]
56+
build warehouse: BUILD_WH [OK sqlbuild_project.toml [targets.dev.warehouses] build]
57+
query warehouse: SQB_WH [OK connection warehouse]
5558
5659
Connection:
5760
account: FJMQFQV-OJ66172

‎src/sqlbuild/.agents/skills/sqlbuild/references/docs/cli/diff.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ In query mode, omit `FROM:TO` and model selectors; each query identifies its own
6060
| `--json` | Print one JSON document to stdout |
6161
| `--select`, `-s` | Select specific models to diff (required in model mode) |
6262
| `--exclude` | Exclude specific models from diffing |
63+
| `--warehouse <name>` | Snowflake warehouse for this invocation; overrides the target's `query` [warehouse group](../concepts/project-configuration.md#command-group-warehouses) and the connection warehouse |
6364

6465
## Examples
6566

‎src/sqlbuild/.agents/skills/sqlbuild/references/docs/cli/freshness.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ sqb --project-dir <path> freshness [flags]
3737
| `--no-sql-analysis` | Disable compile-time SQL analysis (`--no-sql-validation` is an alias) |
3838
| `--select`, `-s` | Select specific sources or models (sources upstream of selected models are included) |
3939
| `--exclude` | Exclude specific sources or models |
40+
| `--warehouse <name>` | Snowflake warehouse for this invocation; overrides the target's `query` [warehouse group](../concepts/project-configuration.md#command-group-warehouses) and the connection warehouse |
4041

4142
## Source selection
4243

‎src/sqlbuild/.agents/skills/sqlbuild/references/docs/cli/janitor.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ sqb --project-dir <path> janitor [flags]
4040
| `--retention-days` | Override the configured retention period (days) before a stale relation is archived |
4141
| `--direct-state-history-versions` | Override how many state-history versions are kept per identity |
4242
| `--drop-old-name-view <name>` | Drop the [compatibility view](../concepts/models/migrations.md#old-names) at a renamed model's old name before it expires. Repeat for several views. Fails with `C503` if no compatibility view is recorded at the name |
43+
| `--warehouse <name>` | Snowflake warehouse for this invocation; overrides the target's `build` [warehouse group](../concepts/project-configuration.md#command-group-warehouses) and the connection warehouse |
4344

4445
## Targets
4546

0 commit comments

Comments
 (0)