Model Selection¶
When working with a project that has many models, you often want to run only a subset. smelt provides --select and --exclude flags to control which models are included in a run.
These flags are available on smelt run, smelt build, and smelt explain.
Selection syntax¶
By name¶
Select a single model by its full canonical path:
When working from inside a namespace directory, use --scope or rely on cwd auto-scoping to shorten the name (see Argument resolution and --scope):
By tag¶
Select all models with a given tag:
Tags are assigned in smelt.yml or in YAML frontmatter:
Include upstream dependencies¶
Prefix with + to include the selected model(s) and all their upstream dependencies:
This ensures that every model marts.daily_revenue depends on is also run, in the correct order.
Include downstream dependents¶
Suffix with + to include the selected model(s) and everything that depends on them:
Include both upstream and downstream¶
Combine the prefix and suffix:
This selects marts.daily_revenue, all its upstream dependencies, and all its downstream dependents.
Multiple selectors¶
The --select flag is repeatable. All selectors are combined (union):
Short form with -s:
Excluding models¶
The --exclude flag uses the same syntax as --select but removes models from the selection:
Exclusions are applied after selections. If you use --select and --exclude together, smelt first builds the selected set, then removes the excluded models.
Practical examples¶
Run a single model¶
Run a model and all its dependencies¶
Run everything downstream of staging¶
Run everything except expensive models¶
Run a specific model with dependencies, excluding one branch¶
Explain selected models¶
How selection works¶
- If no
--selectflags are provided, all models are included. - Each
--selectflag adds models to the set. The+prefix/suffix expands the set by walking the dependency graph. - Each
--excludeflag removes models from the set, using the same expansion rules. - The final set is executed in topological order (dependencies first).
Tip
During development, use --select +model_name to run just the model you are working on along with its dependencies. This is much faster than running the entire project.
Selector names and scope resolution¶
Selector values that are plain model names (not tag:... or path:... selectors) go through the same scope resolution as other CLI arguments. A bare --select events_parsed expands to --select silver.events_parsed when the active scope is silver. An unresolvable bare selector with multiple matches is an error — smelt never silently picks one.
The safest form for scripts and CI is the full canonical path:
When working interactively from inside a namespace directory, use --scope to shorten repeated names:
All smelt output — including selector match lists and run summaries — always uses the canonical dot-path (e.g. silver.events_parsed) regardless of how you specified the selector. Copy-pasting a printed name back into a subsequent command always works.
Further reading¶
- Incremental Models for combining selection with time ranges
- SQL Models for setting tags in YAML frontmatter