feat(ol_dbt_cli): add ol-dbt local snapshot and raw-relation support to ol-dbt diff #2469
Open
rachellougee wants to merge 3 commits into
Open
feat(ol_dbt_cli): add ol-dbt local snapshot and raw-relation support to ol-dbt diff #2469rachellougee wants to merge 3 commits into
rachellougee wants to merge 3 commits into
Conversation
…nd local snapshot command - ol-dbt diff --old-glue/--new-glue compares a local build against the real, already-materialized production table via its Glue-registered view, without requiring a rebuild of that side. --new now defaults to --old's value for this common case. --refresh-glue re-registers Glue views first, since production rebuilds regularly invalidate previously registered ones (stale S3 metadata 404s). - Fixes discovered along the way: a silently-swallowed dbt error in raw column resolution, a double-LIMIT DuckDB parser error, a long-standing f-string brace-escaping bug that broke every per-column comparison with a primary key, and an IcebergScan/UNION-ALL limitation worked around by materializing the glue-registered side into a real table before comparing. - Narrows per-column comparison queries to primary key + compared column instead of selecting every column, and reformats sample mismatches to show only the differing fields per key instead of full-row JSON dumps. - New `ol-dbt local snapshot` command copies a model's current build into a plain table under a new name, for before/after comparisons of the same model across a code change without involving Glue/production. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
🔎 ol-dbt impact — column-level blast radius✅ No column-level downstream impact detected for the changed models. Posted by |
2 tasks
…ntation for ol-dbt diff
Contributor
There was a problem hiding this comment.
Pull request overview
Adds local-development tooling to make dbt model changes easier to validate by enabling “before/after” baselines and allowing ol-dbt diff to compare against already-materialized relations (not only manifest-resolved ref() models). This supports safer dimensional/mart migrations by making row/column-level comparisons against production-derived data practical and repeatable.
Changes:
- Add
ol-dbt local snapshotto materialize a model’s current build under a new table name for baseline comparisons. - Extend
ol-dbt diffwith--old-raw/--new-rawplus schema/database overrides to diff against literal relations, and improve mismatch output formatting. - Expand CLI documentation and tests to cover snapshotting, raw relation resolution, and labeling/output behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/ol_dbt/README.md | Documents workflows for using ol-dbt diff together with ol-dbt local snapshot, including raw-relation comparisons across schemas. |
| src/ol_dbt_cli/ol_dbt_cli/commands/local_dev.py | Adds the local snapshot command that CTAS-copies a model build to a baseline table. |
| src/ol_dbt_cli/ol_dbt_cli/commands/diff.py | Adds raw-relation support (Relation.create), schema/database overrides, improved per-column query generation, and clearer mismatch formatting/labels. |
| src/ol_dbt_cli/tests/test_local_dev.py | Adds unit tests validating snapshot SQL construction and identifier validation. |
| src/ol_dbt_cli/tests/test_diff.py | Adds extensive coverage for raw relation handling, relation Jinja rendering, sample mismatch formatting, labels, and JSON schema updates. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
What are the relevant tickets?
#2407
Description (What does it do?)
Adds a new companion command for local dbt development, plus support in
ol-dbt difffor comparing against it:ol-dbt local snapshot: save a model's current build under a new name, so you can easily compare it against itself before and after a code change.ol-dbt diff --old-raw/--new-raw(plus--old-schema/--new-schema/--old-database/--new-database): compare against an already-materialized table — like a snapshot, or a copy sitting in another schema/database — instead of only a live dbt model.Useful for validating and fixing bugs in how a report joins its dimensional tables — used to find and fix the remaining bugs in enrollment_detail_report see #2468
Test plan
ol-dbt local snapshotused in practice to validate theenrollment_detail_reportfixes in fix(enrollment_detail_report): fix two join fan-out bugs #2468How can this be tested?
Verifies
ol-dbt local snapshot+ol-dbt diff --old-rawcorrectly isolate a code change from production driftcd src/ol_dbtol-dbt local snapshot dim_user --as dim_user_baselineol-dbt diff --target dev_local --old dim_user_baseline --old-raw --new dim_user --primary-key user_pkol-dbt run --select dim_user --target dev_localAdditional Context