Skip to content

Perf: Render scope upstream snapshots#5917

Draft
fresioAS wants to merge 3 commits into
SQLMesh:mainfrom
fresioAS:render-scope-upstream-snapshots
Draft

Perf: Render scope upstream snapshots#5917
fresioAS wants to merge 3 commits into
SQLMesh:mainfrom
fresioAS:render-scope-upstream-snapshots

Conversation

@fresioAS

@fresioAS fresioAS commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Description

Follow-on from #5913 - solves #5905

Adds an opt-in --use-project-index flag to sqlmesh render.
When enabled, SQLMesh loads only the target model and its upstream dependencies, reducing unnecessary project loading and snapshot creation. It safely falls back to a full load if the project index is missing or stale.
Includes CLI documentation and tests for scoped loading and fallback behavior.

Test Plan

395 model live plan

=== Timing summary ===
sqlmesh --gateway core_dev_new render sap.exposed.project 24.98s ok
sqlmesh --gateway core_dev_new render sap.exposed.person 20.52s ok
sqlmesh --gateway core_dev_new render sap.exposed.calendar 18.99s ok
sqlmesh --gateway core_dev_new render --use-project-index sap.exposed.project 7.13s ok
sqlmesh --gateway core_dev_new render --use-project-index sap.exposed.person 5.91s ok
sqlmesh --gateway core_dev_new render --use-project-index sap.exposed.calendar 6.37s ok

Checklist

  • I have run make style and fixed any issues
  • I have added tests for my changes (if applicable)
  • All existing tests pass (make fast-test)
  • My commits are signed off (git commit -s) per the DCO

Add --use-project-index to targeted and full lint. The default path preserves the existing full context load. With both --use-project-index and --model, SQLMesh uses a persistent model-to-file dependency index to load, resolve, and validate only the selected models and their transitive upstream dependencies.

A full indexed lint still loads and lints every model, but creates or refreshes the index for later targeted commands. Missing or expanded dependencies safely retry with a full indexed load.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Andreas Fredhøi <andreas.fredhoi@fresio.no>
@fresioAS
fresioAS force-pushed the render-scope-upstream-snapshots branch from 4e386ea to 82a30cd Compare July 24, 2026 12:25
@fresioAS fresioAS changed the title Render scope upstream snapshots Perf: Render scope upstream snapshots Jul 24, 2026
fresioAS added 2 commits July 24, 2026 14:10
Signed-off-by: Andreas Fredhøi <andreas.fredhoi@fresio.no>
Signed-off-by: Andreas Fredhøi <andreas.fredhoi@fresio.no>
@fresioAS
fresioAS force-pushed the render-scope-upstream-snapshots branch from 82a30cd to 54a0685 Compare July 24, 2026 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant