Feat(dbt_cli): Add --select and --exclude options#5200
Merged
Conversation
0f90cd8 to
5995209
Compare
5995209 to
bf9dad5
Compare
eakmanrq
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.
Adds the
--selectand--excludearguments to thesqlmesh_dbt runandsqlmesh_dbt listcommands (the list command is mainly for testing expressions).This is implemented in terms of generating a complex selection targeting the SQLMesh selector engine rather than attempting to re-implement a new selector engine from scratch.
model_a model_bare translated to|model_a,model_bare translated to&--excludeis implemented in terms of using negation^on each expression and then doing a set intersection with whatever was supplied for--selectThe selectors are still matched against model names, which differ between dbt and sqlmesh.
For example, on jaffle shop, the following selector works in dbt:
dbt list --select customers(selects thejaffle_shop.customersmodel)However, on the SQLMesh selector engine it will return nothing, it needs to be:
sqlmesh_dbt list --select main.customersI intend to address this in a follow-up PR if the groundwork laid in this PR is considered a suitable direction