Skip to content

Feat: Check freshness for mixed external & sqlmesh models - #5499

Merged
VaggelisD merged 6 commits into
mainfrom
vaggelisd/mixed_model_freshness
Oct 22, 2025
Merged

VaggelisD merged 6 commits into
mainfrom
vaggelisd/mixed_model_freshness

Conversation

@VaggelisD

Copy link
Copy Markdown
Collaborator

Follow up PR on model freshness (Previous PR)

This PR enables mixed SQLMesh & external (source) model freshness, e.g:

A: External model 
B: SELECT * FROM A
C: SELECT * FROM A, B

Model C will be evaluated if its upstream models are fresh, which is determined by:

  • C's last_altered_ts compared to external model's (A) INFORMATION_SCHEMA metadata
  • The existence (or not) of parent intervals for SQLMesh models (B), signalling if any model will be evaluated as part of this run

A new freshness-specific test file is added to break up the original test in various scenarios.

Comment thread .circleci/continue_config.yml Resolved
Comment thread sqlmesh/core/signal.py Resolved
Comment thread sqlmesh/core/signal.py Resolved
Comment thread sqlmesh/core/signal.py Resolved
Comment thread sqlmesh/core/scheduler.py Resolved
@VaggelisD
VaggelisD force-pushed the vaggelisd/mixed_model_freshness branch from 46715f5 to 9a8af2e Compare October 13, 2025 10:50
Comment thread sqlmesh/core/scheduler.py Resolved
Comment thread sqlmesh/core/signal.py Resolved
@VaggelisD
VaggelisD force-pushed the vaggelisd/mixed_model_freshness branch from 9a8af2e to d4e3fbe Compare October 20, 2025 10:23
@VaggelisD
VaggelisD force-pushed the vaggelisd/mixed_model_freshness branch from 33101a2 to 82c3671 Compare October 21, 2025 09:18
@VaggelisD
VaggelisD force-pushed the vaggelisd/mixed_model_freshness branch from 82c3671 to 126a902 Compare October 21, 2025 11:38
@VaggelisD
VaggelisD merged commit a98b5c4 into main Oct 22, 2025
@VaggelisD
VaggelisD deleted the vaggelisd/mixed_model_freshness branch October 22, 2025 07:52
scottypate added a commit to scottypate/sqlmesh that referenced this pull request May 18, 2026
* Fix(table_diff): Widen the data types that --decimals applies to (SQLMesh#5542)

* linting and style changes

* fix: dbt as_bool and as_number filters should return their original input values (SQLMesh#5532)

* fix: include schema temp table (SQLMesh#5545)

* Fix: Respect mssql_merge_exists flag and use merge as a strategy (SQLMesh#5544)

* fix: ensure _get_data_objects respects snapshots with different schemas (SQLMesh#5515)

Co-authored-by: Themis Valtinos <73662635+themisvaltinos@users.noreply.github.com>

* Fix: Add dbt-core 1.2.0 support (SQLMesh#5547)

* Fix: do not reduce empty generator when evaluating snapshots (SQLMesh#5548)

* Fix: Unexpected backfill of a parent when an interval outside the parent's range is restated for a child (SQLMesh#5551)

* Chore!: bump sqlglotrs to 27.28.0 (SQLMesh#5556)

* Feat: Check freshness for mixed external & sqlmesh models (SQLMesh#5499)

* Fix: create_test error with query and CTEs included (SQLMesh#5559)

* Fix: Incorrect treatment of the model's table as missing when processing batches with index > 0 (SQLMesh#5560)

* Fix: Only selected models need to be promoted when --inlclude-unmodified flag is provided (SQLMesh#5561)

* fix: added missing execution_time param for CLI audit command (SQLMesh#5563)

* Fix: Cache upstream dependencies when building the evaluation DAG in scheduler (SQLMesh#5569)

* Fix: Temporary disable lsp benchmarks

* Fix: Make macro evaluator locals available from macro calls in jinja (SQLMesh#5568)

* Fix: Require the cache for upstream deps in the scheduler (SQLMesh#5571)

* Fix: always sort Python model dfs in unit tests (SQLMesh#5575)

* ci: fix benchmark running (SQLMesh#5570)

* Feat: use proper `MERGE` statement for Fabric instead of the logical equivalent (SQLMesh#5586)

* Fix: Support of the null meta config in dbt model / source definitions (SQLMesh#5598)

* Docs: Fix set `invalidate_hard_deletes` default to `False` in SCD Type 2 models (SQLMesh#5596)

* Feat: NoMissingUnitTest linter rule (SQLMesh#5294)

* Fix: Include column types in Databricks materialized views with comments (SQLMesh#5578)

* fix(fabric): Alter table workaround (SQLMesh#5511)

Co-authored-by: Toby Mao <toby.mao@gmail.com>

* Chore(deps): Bump actions/setup-python from 5 to 6 (SQLMesh#5322)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Chore(deps): Bump astral-sh/setup-uv from 6 to 7 (SQLMesh#5537)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Chore(deps): Bump actions/setup-node from 4 to 6 (SQLMesh#5553)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Chore!: clean up unit test selection (SQLMesh#5615)

* Feat: add support for METADATA_SCHEMA in ducklake config.yml (SQLMesh#5616)

* Chore(deps): Bump actions/upload-artifact from 4 to 5 (SQLMesh#5564)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Fix(databricks): Add column type only along materialized view comments (SQLMesh#5617)

* Fix: Embedded Model Type Should Not Accept Any Audit (SQLMesh#5577)

Co-authored-by: Jo <46752250+georgesittas@users.noreply.github.com>

* fix: CI/CD Bot exit early before applying plan on unmergeable PR (SQLMesh#5590)

* Chore: Disable snowflake tests temporarily (SQLMesh#5620)

* Fix: Use categorization config in cicd bot environment summary (SQLMesh#5622)

* Fix: Include staged changes in the git selector (SQLMesh#5624)

* chore: remove dbt from sqlmesh tests package (SQLMesh#5626)

* fix: set `ExternalModel`'s default `kind` to `ExternalKind()` (SQLMesh#5634)

* Feat(trino): Introduce custom timestamp type mapping (SQLMesh#5635)

* Chore: Update type annotation for pandas and pandas-stubs >= v2.3.3 (SQLMesh#5637)

* Fix bigquery cli engine config test

* Update naming conventions and how to set the property

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Erin Drummond <erin.dru@gmail.com>
Co-authored-by: David Dai <ddai@tobikodata.com>
Co-authored-by: Ryan Eakman <6326532+eakmanrq@users.noreply.github.com>
Co-authored-by: Themis Valtinos <73662635+themisvaltinos@users.noreply.github.com>
Co-authored-by: Alexander Butler <41213451+z3z1ma@users.noreply.github.com>
Co-authored-by: Chris Rericha <67359577+crericha@users.noreply.github.com>
Co-authored-by: Jo <46752250+georgesittas@users.noreply.github.com>
Co-authored-by: Iaroslav Zeigerman <zeigerman.ia@gmail.com>
Co-authored-by: Vaggelis Danias <daniasevangelos@gmail.com>
Co-authored-by: Trey Spiller <1831878+treysp@users.noreply.github.com>
Co-authored-by: Anatoli Makarevich <makaroni4@gmail.com>
Co-authored-by: Ben <9087625+benfdking@users.noreply.github.com>
Co-authored-by: Mattias Thalén <bitter-polders0x@icloud.com>
Co-authored-by: Nick Nowicki <35818104+nnowicki@users.noreply.github.com>
Co-authored-by: Cortland Goffena <30168413+cmgoffena13@users.noreply.github.com>
Co-authored-by: Andreas Fred-Ojala <andreasfo@gmail.com>
Co-authored-by: Andreas <65893109+fresioAS@users.noreply.github.com>
Co-authored-by: Toby Mao <toby.mao@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: bearInTheRoad <60107263+bearInTheRoad@users.noreply.github.com>
Co-authored-by: Brian Crant <17074379+bcrant@users.noreply.github.com>
Co-authored-by: etonlels <etonlels@gmail.com>
Co-authored-by: Vincent Chan <vchan@users.noreply.github.com>
fresioAS pushed a commit to fresioAS/sqlmesh that referenced this pull request May 31, 2026
Signed-off-by: fresioAS <andreas.fredhoi@three60energy.com>
fresioAS pushed a commit to fresioAS/sqlmesh that referenced this pull request Jul 13, 2026
Signed-off-by: fresioAS <andreas.fredhoi@three60energy.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants