Concepts
Selectors
Target specific models, paths, tags, or DAG subsets with select and exclude flags.
Selectors let you scope commands to specific subsets of your project. They work with plan, build, test, audit, seed, clone, and diff.
Basic usage
Section titled “Basic usage”sqb build --select daily_revenuesqb build --select daily_revenue customer_status_snapshotsqb build --exclude stg_customers--select (or -s for short) accepts one or more names. Multiple values are unioned. Space-separated names within one --select are also unioned. --exclude subtracts from the selected set.
When no --select is provided, all models are selected.
Selector types
Section titled “Selector types”Select a single resource by name:
sqb build --select fact_ordersBare names accept glob patterns. This selects every resource whose name starts with
intermediate_:
sqb build --select "intermediate_*"Name globs compose with graph expansion. For example, +intermediate_* selects every matching
resource and all of their upstream dependencies. Quote patterns in shell commands so your shell
does not expand * against files in the current directory.
Select all models with a specific tag:
sqb build --select tag:stagingsqb build --select tag:acceptanceSelect all models under a directory path:
sqb build --select path:models/martssqb build --select models/martssqb build --select path:models/intermediateAny name containing / is treated as a path selector, so path:models/marts and a bare models/marts work the same way. Path selectors require an explicit root directory: models/, tasks/, assets/, checks/, or loaders/. Nested paths work too: models/staging/orders.
Seed and source
Section titled “Seed and source”sqb build --select seed:waffle_typessqb build --select source:raw__ordersGraph expansion
Section titled “Graph expansion”Upstream
Section titled “Upstream”Select a model plus all its upstream dependencies:
sqb build --select +daily_activity_rollupDownstream
Section titled “Downstream”Select a model plus all its downstream dependents:
sqb build --select fact_orders+Bidirectional
Section titled “Bidirectional”sqb build --select +fact_orders+Graph expansion works with all selector types:
sqb build --select +tag:martssqb build --select path:models/staging+Path-between selectors
Section titled “Path-between selectors”Select all models on the shortest path between two nodes:
sqb build --select fact_orders~daily_activity_rollupWith endpoint expansion:
sqb build --select +fact_orders~daily_activity_rollup+This selects:
- All upstreams of
fact_orders - Every model on the path between
fact_ordersanddaily_activity_rollup - All downstreams of
daily_activity_rollup
This is useful for rebuilding a specific slice of the DAG without manually listing every model in between.
Intersection
Section titled “Intersection”Use commas to intersect selector results:
sqb build --select "tag:staging,path:models/finance"This selects only models that match both conditions - in this case, models tagged staging that are also under the models/finance directory.
Combining select and exclude
Section titled “Combining select and exclude”# Build all marts except daily_revenuesqb build --select path:models/marts --exclude daily_revenue
# Build everything upstream of fact_orders, excluding staging modelssqb build --select +fact_orders --exclude tag:stagingError handling
Section titled “Error handling”Unknown resource names, name patterns with no matches, empty paths, and malformed selectors produce clear error messages:
unknown selector name 'nonexistent_model'unknown selector pattern 'missing_*'no models found under path 'models/nonexistent'.no models found with tag 'nonexistent_tag'path selector 'fact_orders~' requires names on both sides of '~'If a path selector omits the root directory, SQLBuild asks for the explicit form:
path selectors require an explicit root: use 'models/', 'tasks/', 'assets/', 'checks/', or 'loaders/'