Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.sqlbuild.com/llms.txt

Use this file to discover all available pages before exploring further.

Selectors let you scope commands to specific subsets of your project. They work with plan, build, run, test, audit, seed, clone, and diff.

Basic usage

sqb --project-dir examples/waffle_shop build --select daily_revenue
sqb --project-dir examples/waffle_shop build --select daily_revenue customer_status_snapshot
sqb --project-dir examples/waffle_shop 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

Name

Select a single model by name:
sqb build --select fact_orders

Tag

Select all models with a specific tag:
sqb build --select tag:staging
sqb build --select tag:acceptance

Path

Select all models under a directory path:
sqb build --select path:marts
sqb build --select /marts
sqb build --select marts/
sqb build --select path:intermediate
Any name containing / is treated as a path selector. path:marts, /marts, and marts/ all work the same way. Nested paths work too: staging/orders. The models/ prefix is stripped automatically, so use path:marts not path:models/marts.

Seed and source

sqb build --select seed:waffle_types
sqb build --select source:raw_orders

Graph expansion

Upstream

Select a model plus all its upstream dependencies:
sqb build --select +daily_activity_rollup

Downstream

Select a model plus all its downstream dependents:
sqb build --select fact_orders+

Bidirectional

sqb build --select +fact_orders+
Graph expansion works with all selector types:
sqb build --select +tag:marts
sqb build --select path:staging+

Path-between selectors

Select all models on the shortest path between two nodes:
sqb build --select fact_orders~daily_activity_rollup
With endpoint expansion:
sqb build --select +fact_orders~daily_activity_rollup+
This selects:
  • All upstreams of fact_orders
  • Every model on the path between fact_orders and daily_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

Use commas to intersect selector results:
sqb build --select "tag:staging,stg_orders"
This selects only models that match both conditions - in this case, models tagged staging that are also named stg_orders.

Combining select and exclude

# Build all marts except daily_revenue
sqb build --select path:marts --exclude daily_revenue

# Build everything upstream of fact_orders, excluding staging models
sqb build --select +fact_orders --exclude tag:staging

Error handling

Unknown model names, empty paths, and malformed selectors produce clear error messages:
Unknown selector name 'nonexistent_model'
No models found under path 'nonexistent'.
No models found with tag 'nonexistent_tag'
Path selector 'fact_orders~' requires names on both sides of '~'
If a path selector accidentally includes the models/ prefix, SQLBuild suggests the correct form:
No models found under path 'models/marts'. (the 'models/' prefix is stripped automatically — try 'path:marts')