feat: dbt adapter allow invalid ref for tests#5207
Merged
Conversation
erindru
reviewed
Aug 22, 2025
sqlmesh/dbt/context.py
Outdated
| models[ref] = t.cast(ModelConfig, model) | ||
| else: | ||
| raise ConfigError(f"Model '{ref}' was not found.") | ||
| exception = MissingModelError(f"Model '{ref}' was not found.") |
Collaborator
There was a problem hiding this comment.
Any reason you didnt follow the existing pattern with ApiError, NodeAuditsErrors etc and make model_name part of the constructor?
Collaborator
Author
There was a problem hiding this comment.
I just didn't think about of it for some reason and yeah that is a better approach. Updating.
4fd2ae1 to
1107e93
Compare
1107e93 to
53c1ad3
Compare
izeigerman
approved these changes
Aug 22, 2025
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.
Dbt ignores with a warning tests that have refs to models that don't exist. This mimics that behavior.
dbt function that explicitly does not fail if test: https://github.com/dbt-labs/dbt-core/blob/0836095a572532fc22b1c0981346eebe56f7d1fb/core/dbt/parser/manifest.py#L1324-L1332
I noticed in testing that constraints that make invalid refs also do not affect execution so I included that in the test although I didn't have to make any code changes at this time to support it.