@@ -7780,6 +7780,8 @@ SQLBuild templates such as `ref()` are not expanded.
77807780sqb diff \
77817781 --left-query 'SELECT order_id, amount_cents FROM analytics.orders_before' \
77827782 --right-query 'SELECT order_id, amount_cents FROM analytics.orders_after' \
7783+ --left-label before \
7784+ --right-label after \
77837785 --key order_id
77847786
77857787sqb diff \
@@ -7793,6 +7795,9 @@ sqb diff \
77937795Query mode defaults to a full comparison and also supports `--schema-only`. It does not accept
77947796`--bounded`; put the desired filter in both SQL inputs instead.
77957797
7798+ Raw-query mode loads configuration and the selected adapter without importing unrelated project
7799+ sinks, hooks, loaders, or providers.
7800+
77967801### Comparison modes
77977802
77987803Model mode requires exactly one mode. Raw-query mode defaults to full when no mode is supplied:
@@ -7979,19 +7984,47 @@ sqb diff prod:dev --full --select customer_status_snapshot --max-column-examples
79797984Example limits only control diagnostic values printed after comparison. They are separate from
79807985`row_diff_sample_rows`, which controls how many unique keys receive the wide value comparison.
79817986
7987+ Long values default to 160 rendered characters. SQLBuild shows context around the first difference,
7988+ marks truncation, and reports the original length without changing exact comparison counts. Control
7989+ value evidence independently from example counts:
7990+
7991+ ```bash
7992+ sqb diff \
7993+ --left-query-file queries/orders_before.sql \
7994+ --right-query-file queries/orders_after.sql \
7995+ --key order_id \
7996+ --max-value-length 500
7997+
7998+ sqb diff \
7999+ --left-query-file queries/orders_before.sql \
8000+ --right-query-file queries/orders_after.sql \
8001+ --key order_id \
8002+ --no-example-values
8003+
8004+ sqb diff \
8005+ --left-query-file queries/orders_before.sql \
8006+ --right-query-file queries/orders_after.sql \
8007+ --key order_id \
8008+ --full-example-values
8009+ ```
8010+
8011+ `--verbose` increases the example count but does not remove the value-length bound.
8012+
79828013### Structured output
79838014
79848015Use `--json-output PATH` to write a stable structured result while retaining the normal terminal
7985- summary:
8016+ summary, or `--json` to write one JSON document to stdout with progress on stderr :
79868017
79878018```bash
79888019sqb diff prod:dev --bounded 14d --sample-rows 50000 --select order_lines --json-output diff.json
8020+ sqb diff --left-query-file before.sql --right-query-file after.sql --key order_id --json
79898021```
79908022
79918023Each model records `schema_only`, `exhaustive`, or `sampled` comparison scope; requested and observed
79928024cursor coverage; bounded population and compared key counts; seed and configured limit; row result
7993- counts; and changed-column counts. The top-level status distinguishes `no_differences_found` from
7994- `differences_found`.
8025+ counts; and changed-column counts. Query output additionally includes named inputs,
8026+ `query_comparisons`, sparse nonzero `column_mismatches`, lifecycle timings, and explicit evidence
8027+ truncation metadata. Existing `models` output remains for compatibility.
79958028
79968029### Invocation safety limits
79978030
@@ -8022,9 +8055,10 @@ sqb diff prod:dev --full --select tag:acceptance
80228055
80238056### Exit codes
80248057
8025- `sqb diff` returns exit code `0` when no differences are found, and `1` when any input has schema or
8026- row differences or the comparison cannot execute successfully. This makes it usable in CI pipelines
8027- as a validation gate.
8058+ Complete comparisons return `0` when no differences are found and `1` for findings. Raw-query mode
8059+ returns `2` when safety, schema, or key preflight prevents complete value evidence, and `3` for
8060+ setup, connection, materialization, comparison execution, ownership publication, or cleanup
8061+ failure. Human and JSON output carry the same outcome.
80288062
80298063## Execution Observability
80308064
@@ -14541,17 +14575,23 @@ and falls back to a full row comparison when no cursor is configured.
1454114575| `--sample-seed` | Override the deterministic sample seed |
1454214576| `--exhaustive` | Disable inherited sampling for this invocation |
1454314577| `--json-output` | Write structured comparison scope, coverage, and results to a JSON file |
14578+ | `--json` | Write one structured JSON document to stdout; progress remains on stderr |
1454414579| `--max-models` | Fail when the selected scope contains more models than this limit |
1454514580| `--max-columns` | Fail when either side of a model has more columns than this limit |
1454614581| `--left-query` | Literal read-only SQL for the left side |
1454714582| `--left-query-file` | UTF-8 SQL file for the left side |
1454814583| `--right-query` | Literal read-only SQL for the right side |
1454914584| `--right-query-file` | UTF-8 SQL file for the right side |
14585+ | `--left-label` | Display and structured-output label for the left query |
14586+ | `--right-label` | Display and structured-output label for the right query |
1455014587| `--target` | Target connection for raw-query mode; defaults to the active target |
1455114588| `--key` | Row identity column; repeat for a composite key or to override model configuration |
1455214589| `--unkeyed` | Compare exact full-row multiplicities without a key |
1455314590| `--exclude-column` | Column to omit from row comparison; repeat as needed |
1455414591| `--tolerance` | Per-column numeric rule such as `amount:absolute=0.01`; repeat as needed |
14592+ | `--max-value-length` | Maximum rendered characters per example value (default: 160) |
14593+ | `--no-example-values` | Retain example keys and counts while suppressing values |
14594+ | `--full-example-values` | Explicitly opt in to complete example values |
1455514595| `--no-sql-analysis` | Disable compile-time SQL analysis (`--no-sql-validation` is an alias) |
1455614596| `--select`, `-s` | Select specific models to diff (required in v1) |
1455714597| `--exclude` | Exclude specific models from diffing |
@@ -14578,6 +14618,8 @@ sqb diff prod:dev --bounded 14d --exhaustive --select order_lines
1457814618sqb diff \
1457914619 --left-query-file queries/orders_before.sql \
1458014620 --right-query-file queries/orders_after.sql \
14621+ --left-label before \
14622+ --right-label after \
1458114623 --key account_id \
1458214624 --key order_id
1458314625```
0 commit comments