Feat(dbt_cli): Add --select
and --exclude
options
#5200
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
--select
and--exclude
arguments to thesqlmesh_dbt run
andsqlmesh_dbt list
commands (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_b
are translated to|
model_a,model_b
are translated to&
--exclude
is implemented in terms of using negation^
on each expression and then doing a set intersection with whatever was supplied for--select
The 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.customers
model)However, on the SQLMesh selector engine it will return nothing, it needs to be:
sqlmesh_dbt list --select main.customers
I intend to address this in a follow-up PR if the groundwork laid in this PR is considered a suitable direction