Feat(dbt_cli): Add support for '--profile' and '--target'#5174
Merged
Conversation
erindru
commented
Aug 18, 2025
| from sqlmesh.dbt.loader import sqlmesh_config | ||
|
|
||
| dbt_python_config = sqlmesh_config(project_root=dbt_project_file.parent) | ||
| dbt_python_config = sqlmesh_config( |
Collaborator
Author
There was a problem hiding this comment.
The config_loader_kwargs parameter was added to Context so it could flow through to here.
I first attempted to make these arguments to the DbtLoader, but theyre needed to work out the ConnectionConfig and by the time DbtLoader is invoked it's too late
erindru
commented
Aug 18, 2025
| raise ConfigError( | ||
| f"Target '{target_name}' not specified in profiles for '{context.profile_name}'." | ||
| f"Target '{target_name}' not specified in profiles for '{context.profile_name}'. " | ||
| f"The valid target names for this profile are:\n{target_names}" |
Collaborator
Author
There was a problem hiding this comment.
I noticed that the dbt cli lists valid targets if you get the profile correct but the target wrong, so I updated this to do the same
izeigerman
approved these changes
Aug 18, 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.
Enables the usage of the
--profileflag (to select a specific DBT profile) and the--targetflag (to select a target within that profile) for thesqlmesh_dbtCLI.Also adds a global error handler so when the target or profile doesnt match, we dont print a stack trace.