Why declarative data models scale better than script-driven pipelines
In brief
Use a declarative model graph for shared warehouse tables when several people need to change them safely.
- Declare each output's grain, dependencies, and checks where a reviewer can inspect them.
- Keep scripts for procedural work such as extraction, API calls, and one-time repairs.
Declarative data models scale by making desired outputs and their dependencies inspectable. Script-driven pipelines scale execution steps.
Both can move data. The distinction matters when the platform must support many safe changes by people who no longer hold the whole system in their heads.
A model graph describes the state we want
A declarative action says: build this table or view at this grain from these dependencies, under these assertions and materialization rules.
The framework can compile a dependency graph, select affected actions, create objects in the right order, and expose downstream impact. A reviewer starts from the intended data product rather than replaying the procedural history that happens to create it.
A script says: execute these commands in this order. That’s appropriate when order and side effects are the substance of the job. It’s a weaker primary abstraction for a warehouse whose important question is what each table represents.
Shared change is the scaling pressure
Table count alone doesn’t make a platform hard to scale. The cost comes from changing one definition safely across dependencies, environments, and persisted state.
Declarative structure helps because it can keep together:
- model grain and schema
- dependency references
- incremental or replacement behavior
- partitioning and clustering
- assertions and documentation
- ownership and tags
That information lets tooling and reviewers reason about blast radius. In a script pile, the same decisions are often implicit in command order, filenames, scheduler configuration, and temporary conventions.
The platform becomes slower when every change requires the original author to translate those conventions. The apparent flexibility depends on that person remaining available.
Compilation gives abstraction a boundary
SQLX and helper code can generate repetitive declarations while compilation produces concrete SQL and actions for review. This is useful when the generated behavior remains visible and deterministic.
The abstraction should reduce mechanical duplication without hiding business meaning. A macro that standardizes audit columns or source declarations may help. A generic function that accepts twenty options and generates the model’s entire semantic core usually doesn’t.
Declarative doesn’t mean “write less.” It means the desired state and generated behavior can be inspected separately from the mechanism that expands them.
Environments become deliberate variations
Development, staging, and production should compile the same model semantics against different schemas, projects, or controlled configuration. The environment chooses where and at what scale the graph runs. It shouldn’t choose another definition of the metric.
This makes review and testing meaningful. A development build can exercise the same action with bounded data, assertions, and dependency shape before production owns the state change.
Script-driven systems often accumulate environment-specific branches because each execution path grew independently. That convenience becomes drift.
Declarative models constrain operations usefully
A named incremental model must state its key, update scope, and materialization behavior. A view must state its dependencies. Assertions must attach to outputs. These constraints force design decisions into the repository.
They don’t guarantee good decisions. They make missing decisions harder to conceal behind successful execution.
This is why declarative models pair with thin orchestration. The model graph owns relational state. The workflow invokes it, coordinates external systems, and handles operational policy.
Scripts still belong at boundaries
Use scripts for source extraction, API interaction, files, migrations, local analysis, non-relational algorithms, and one-time repairs. Those jobs are often inherently procedural.
The boundary should return an explicit artifact or dataset to the model graph. A parser writes normalized records. An API extractor writes a source table and batch metadata. A migration invokes the same model definitions where possible.
Don’t outlaw scripts. Prevent them from becoming the only place where shared analytical meaning can be found.
Declarative structure has a cost
The team owns compilation, framework upgrades, repository conventions, development schemas, deployment, and the quality of its abstractions. For a handful of disposable transforms, that structure can cost more than it buys.
Adopt it when outputs are scheduled, shared, stateful, or depended on by others. That’s when review, impact analysis, assertions, and one production path begin compounding.
When declarative structure fits
Use scripts while work is local and procedural. Promote shared warehouse outputs into a declarative graph once their desired state, dependencies, and lifecycle matter more than the sequence that first produced them.
A declarative platform scales when another engineer can change a model by reading what the system is meant to become, not by reconstructing every step its first author once ran.
Related work
More in this domain: Data
Browse allWhen cold history should stay in BigQuery
Keep cold history in BigQuery when retrieval costs would outweigh the storage savings.
BigQuery global queries or a local serving copy?
A global BigQuery query can suit occasional selective reads. An approved local copy can save transfers when reports repeatedly read the same remote data.
Use BigQuery clones for bounded development work
Use a writable BigQuery clone when a test needs the source data's distribution or history. Use a small fixture when it reproduces the problem.
When external Parquet deserves a native BigQuery copy
Keep Parquet external for occasional reads. A native BigQuery copy can pay off when reports repeatedly scan the same files.
Publish a BigQuery dataset without sponsoring every reader's queries
Publish a BigQuery dataset when readers need SQL and have their own execution project. Offer versioned downloads for readers who just need the data.
Related patterns
Why we model around decision boundaries, not source cleanup
Design an analytical model around the decision it supports and what one output row represents.
Dataform vs. transformation scripts: keeping warehouse changes reviewable
Use Dataform for shared BigQuery models when reviewers need to see dependencies, materialization, and checks together. Keep simpler standalone work in scripts.
Incremental models are only safe when change detection is explicit
Use an incremental model when you can identify every output key an upstream change affects more cheaply than rebuilding.
How we decide whether a transformation belongs in SQLX, code, or orchestration
Use SQLX for relational transformations, code for nonrelational algorithms and external calls, and orchestration for sequencing.