Feat!: bring dbt node information through to SQLMesh#5412
Merged
Conversation
98bebcf to
5f52a69
Compare
5f52a69 to
a53e2eb
Compare
izeigerman
reviewed
Sep 22, 2025
izeigerman
reviewed
Sep 22, 2025
| metadata.append(f"{k}:{gen(v)}") | ||
|
|
||
| if self.dbt_node_info: | ||
| metadata.append(self.dbt_node_info.json(sort_keys=True)) |
Collaborator
There was a problem hiding this comment.
I think we need to extend the ./.circleci/test_migration.sh test to also run on sushi_dbt project and not just sushi, since we now have dbt-specific logic when hashing.
Collaborator
Author
There was a problem hiding this comment.
I've added this and I think it's failing in the way you expected it to:
**Metadata Updated:**
- `sushi.customer_revenue_by_day`
- `sushi.customers`
- `sushi.top_waiters`
- `sushi.waiter_as_customer_by_day`
- `sushi.waiter_revenue_by_day_v1`
- `sushi.waiter_revenue_by_day_v2`
- `sushi.waiters`
- `sushi_raw.items`
- `sushi_raw.order_items`
- `sushi_raw.orders`
- `sushi_raw.waiter_names`
Exited with code exit status 1
This is correct because after the migration in this PR runs and a new plan is made, the extra fields get read from disk and show as a metadata change because they go from being empty in state to being populated in state
izeigerman
approved these changes
Sep 22, 2025
Collaborator
izeigerman
left a comment
There was a problem hiding this comment.
Please consider extending the migration test. LGTM othterwise
a53e2eb to
0007661
Compare
0007661 to
e551d67
Compare
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.
This PR does the following:
dbt_namefrom_Nodeand replace it withdbt_node_info(as opposed to adding more top-level fields directly to_Node)dbt_node_infoto the model metadata values to help ensure that state stays in sync with realitydbt_name->dbt_node_infodbt_nameonly represents theunique_idand not the other fields(that is, a low impact virtual update to synchronise state with reality)
sqlmesh_dbt listto show that theyre workingAlso, some housekeeping in the test suite:
create_empty_projectfixtures, so I combined them and moved them to a common locationjaffle_shop_duckdbfixture out of the sqlmesh_dbt cli conftest and into the main dbt conftest so I could use it intest_integrationto verify the dbt names matched the output ofdbt listIn a follow-up PR, I have built on this to enable the selector engine to utilise the dbt names if they are available.
This PR also puts some structure in place to be able to implement things like the dbt graph in terms of
Context.snapshots, rather than storing the entire graph in every modelJinjaMacroRegistrythat uses it