Repository navigation
Description
Hi!
Since v0.119.0 sqlmesh run does not require any model definitions in the models/ to refresh model data.
While clearing some confusion I had about sqlmesh plan --restate-model's behavior, it was pointed out to me that it should only refresh data, but not update models' definitions (like a regular plan would).
So I expected that a restatement should also not require the definitions, if it only refreshes data. But when testing the behavior it does not seem to be the case.
repro
setup
$ uv venv && uv pip install sqlmesh && . .venv/bin/activate
$ sqlmesh --version
0.127.1t.sh -- helper script
#!/usr/bin/env bash
function remove_definitions {
rm -rf models seeds tests audits macros logs .cache
}
remove_definitions
rm -rf config.yaml db.db
sqlmesh init duckdb
sqlmesh plan --auto-apply >/dev/null
remove_definitionsI believe a restatement shouldn't require model definitions in order to only refresh data, similar to run.
$ ./t.sh && sqlmesh plan -r sqlmesh_example.full_model -s '' -e '' --auto-apply
Error: `('/tmp/sqlmesh-tmp',)` doesn't seem to have any models... cd into the proper directory or specify the path(s) with -p.Defining a dummy full_model makes it work:
$ mkdir models && echo 'MODEL (name sqlmesh_example.full_model); select 1 as foo' > models/full_model.sql
$ sqlmesh plan -r sqlmesh_example.full_model -s '' -e '' --auto-apply
No differences when compared to `prod`
Models needing backfill (missing dates):
└── sqlmesh_example.full_model: 2024-10-15 - 2024-10-15
[...]
The target environment has been updated successfullyAnd the original model definition is not replaced by the dummy that was introduced, as expected:
$ duckdb -c 'select * from sqlmesh_example.full_model' db.db
┌─────────┬────────────┐
│ item_id │ num_orders │
│ int32 │ int64 │
├─────────┼────────────┤
│ 2 │ 1 │
│ 1 │ 5 │
│ 3 │ 1 │
└─────────┴────────────┘Am I misguided here?
Thanks in advance.
For completeness sake, to demonstrate that sqlmesh run behaves like this since v0.119:
$ uv pip install -U sqlmesh==0.118.0 && ./t.sh && sqlmesh run
[...]
Error: `('/tmp/sqlmesh-tmp',)` doesn't seem to have any models... cd into the proper directory or specify the path(s) with -p.
$ uv pip install -U sqlmesh==0.119.0 && ./t.sh && sqlmesh run
[...]
Run finished for environment 'prod'
Activity
georgesittas commentedon Oct 18, 2024
This does look like a bug, @izeigerman can you verify?
izeigerman commentedon Oct 24, 2024
Yes, restatements shouldn't require model files now that we purposefully ignore local changes when doing the restatement.
hardeybisey commentedon Nov 9, 2024
@izeigerman can you assign this to me. Thanks.
yadrielsamir commentedon Nov 14, 2026
@hardeybisey, are you still working on this? If not, I'd like to pick it up.
I reproduced it on 0.236.4 (macOS, Python 3.9.6): with the model files removed,
sqlmesh plan -r sqlmesh_example.full_model -s '' -e '' --auto-applystill fails with "doesn't seem to have any models", and adding a dummy model still makes the restatement succeed.yadrielsamir commentedon Nov 14, 2026
I see @mokashang opened #6219 for this just before my comment, so I'll step back from this one. In case it helps review, I also reproduced the bug on the 0.236.4 release on macOS with the same "doesn't seem to have any models" error.