Reuse matching relations
Dev targets can opt into reusing relations from another target (for example prod) instead of rebuilding from scratch. When a model’s version identity in dev matches the version already built in prod, SQLBuild clones or copies the relation rather than re-executing the query, zero compute for models that match. Configure it on the target:reuse_from target’s fingerprints and relation state. A model is reused when:
- The expected version identity matches the
reuse_fromtarget’s built version. - The relation exists in the
reuse_fromtarget. - Source freshness in the
reuse_fromtarget is current.
reuse_hard_copy = true on the target to force a full data copy instead of a zero-copy clone. This is useful when the adapter does not support cloning, or when you need an independent copy.
reuse_from cannot be used together with defer_sources_to on the same target.
Reuse keys on the same fingerprints SQLBuild uses for change detection. See Planning and Change Detection for how version identities are computed.
Cloning upstream inputs
When you build a slice of your project with--select, the root models of your selection (the ones whose upstream dependencies you did not also select) still need their inputs to exist. If a direct upstream is missing or stale, SQLBuild can clone it from production instead of forcing you to build the whole upstream chain.
For each unselected direct upstream of a root model, SQLBuild clones (or copies) whatever the reuse origin currently has into your target. Two things to be clear about:
- No catch-up. You get production’s current data as the input, exactly as it is. SQLBuild does not run an incremental delta on a cloned input, even if the upstream is an incremental model.
- Not fingerprinted. A cloned input is materialized only to feed the build, so SQLBuild does not write a fingerprint for it. This is deliberate: the upstream was never actually built or validated in this target, so recording it as current would let change detection wrongly skip it later. The next time you select that model, it is planned from scratch as if the clone had never happened.
reuse_hard_copy and zero-copy clone behavior as reuse above, and appear under Dependency baseline in the plan output.
