You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature Request: sqlmesh render loads and processes the entire project context for a single model #5905
When running sqlmesh render <model>, the full project context is initialized and
all snapshots are passed into the renderer, even though only the target model and
its transitive upstream dependencies are relevant to the operation.
Current Behavior
sqlmesh render takes a single model as its argument:
Usage: sqlmesh render [OPTIONS] MODEL
Render a model's query, optionally expanding referenced models.
Despite targeting one model, the following happens:
The entire Context is initialized — all models, macros, audits, and snapshots
across the project are parsed and loaded.
QueryRenderer.render() (in sqlmesh/core/renderer.py) receives the full
snapshot dictionary (documented as "All upstream snapshots by model name").
_to_table_mapping() iterates over every snapshot in the project to build a
table mapping, regardless of whether those models are reachable from the target.
_resolve_tables() applies this full mapping while walking the query AST.
Expected Behavior
For sqlmesh render <model>, only the target model and its transitive upstream
dependencies need to be resolved. The context initialization and snapshot
resolution should be scoped to the subgraph rooted at the target model, rather
than the full project DAG.
Why This Matters
Performance: In large projects with hundreds or thousands of models, loading
the full context and building a full snapshot mapping is expensive. A user
rendering a single leaf model should not pay the cost of loading models in
unrelated parts of the DAG.
Unnecessary work: _to_table_mapping and _resolve_tables process snapshots
that can never appear in the target model's query, making the work provably
wasteful.
Scalability: As projects grow, the overhead of sqlmesh render grows with
the total number of models rather than with the depth/breadth of the target
model's upstream graph.
Proposed Direction
When sqlmesh render <model> is invoked, compute the set of transitive upstream
dependencies of the target model from the DAG.
Restrict context loading (or at minimum snapshot resolution) to that subgraph.
Pass only the relevant subset of snapshots to QueryRenderer.render() instead
of the full project snapshot dictionary.
This is analogous to how graph-aware tools scope work to the relevant subgraph
rather than the full graph when a specific node is targeted.
changed the title [-]Feature Request: sqlmesh render loads and processes the entire project context for a single model[/-][+]Feature Request: `sqlmesh render` loads and processes the entire project context for a single model[/+]on Jul 20, 2026
Activity
[-]Feature Request: sqlmesh render loads and processes the entire project context for a single model[/-][+]Feature Request: `sqlmesh render` loads and processes the entire project context for a single model[/+]