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
@@ -168,10 +169,7 @@ Line 5 describes what environments the plan will affect when applied - a new `pr
168
169
169
170
Lines 7-11 of the output show that SQLMesh detected three new models relative to the current empty environment.
170
171
171
-
Lines 12-15 list each model that will be executed by the plan, along with the date intervals that will be run. Note that `full_model` and `incremental_model` both show `2020-01-01` as their start date because:
172
-
173
-
1. The incremental model specifies that date in the `start` property of its `MODEL` statement and
174
-
2. The full model depends on the incremental model.
172
+
Lines 12-16 list each model that will be executed by the plan, along with the date intervals or refresh types. For both `full_model` and `seed_model`, it shows `[full refresh]`, while for `incremental_model` it shows a specific date range `[2020-01-01 - 2025-04-17]`. The incremental model date range begins from 2020-01-01 because the `full` model kind always fully rebuilds its table.
175
173
176
174
The `seed_model` date range begins on the same day the plan was made because `SEED` models have no temporality associated with them other than whether they have been modified since the previous SQLMesh plan.
177
175
@@ -254,20 +252,24 @@ Line 16 asks you whether to proceed with executing the model backfills described
SQLMesh performs three actions when applying the plan:
@@ -276,11 +278,13 @@ SQLMesh performs three actions when applying the plan:
276
278
- Evaluating/running the models
277
279
- Virtually updating the plan's target environment
278
280
279
-
Line 2 provides a progress bar and elapsed time for the first step of creating new model versions (very fast in this simple project). Line 4 reports that the first step has completed.
281
+
Lines 2-4 show the progress and completion of the first step - updating the physical layer (creating new model versions).
282
+
283
+
Lines 6-11 show the execution of each model with their specific operations and timing. Line 6 shows the seed model being inserted, line 8 shows the incremental model being inserted for the specified date range, and line 10 shows the full model being processed with its audit check passing.
280
284
281
-
Lines 6-8 show the run time for each model in the project. Line 9 provides a progress bar and total elapsed time for the second step of evaluating the models. Line 11 reports that the second step has completed.
285
+
Lines 12-14 show the progress and completion of the second step - executing model batches.
282
286
283
-
Line 13 provides a progress bar and total elapsed time for the third step of virtually updating the plan's target environment. Line 15 reports that the third step has completed and the `prod` environment now points to the tables created during model execution.
287
+
Lines 16-18 show the progress and completion of the final step - virtually updating the plan's target environment, which makes the data available for querying.
284
288
285
289
You've now created a new production environment with all of history backfilled.
286
290
@@ -323,63 +327,75 @@ Run `sqlmesh plan dev` to create a development environment called `dev`:
Line 6 of the output states that a new environment `dev` will be created from the existing `prod` environment.
359
367
360
-
Lines 8-14 summarize the differences between the modified model and the `prod` environment, detecting that we directly modified `incremental_model` and that `full_model` was indirectly modified because it selects from the incremental model. Note that the model schemas are `sqlmesh_example__dev`, indicating that they are being created in the `dev` environment.
368
+
Lines 10-15 summarize the differences between the modified model and the `prod` environment, detecting that we directly modified `incremental_model` and that `full_model` was indirectly modified because it selects from the incremental model. Note that the model schemas are `sqlmesh_example__dev`, indicating that they are being created in the `dev` environment.
361
369
362
-
On line 28, we see that SQLMesh automatically classified the change as `Non-breaking` because it understood that the change was additive (added a column not used by `full_model`) and did not invalidate any data already in `prod`.
370
+
On line 31, we see that SQLMesh automatically classified the change as `Non-breaking` because it understood that the change was additive (added a column not used by `full_model`) and did not invalidate any data already in `prod`.
363
371
364
372
Enter `y` at the prompt and press `Enter` to apply the plan and execute the backfill:
Note that a backfill was not necessary and only a Virtual Update occurred.
488
+
Note that a backfill was not necessary and only a Virtual Update occurred, as indicated by the "SKIP: No physical layer updates to perform" and "SKIP: No model batches to execute" messages. This is because the changes were already calculated and executed in the `dev` environment, and SQLMesh is smart enough to recognize that it only needs to update the virtual references to the existing tables rather than recomputing everything.
467
489
468
490
### 5.2 Validate updates in prod
469
491
Double-check that the data updated in `prod` by running `sqlmesh fetchdf "select * from sqlmesh_example.incremental_model"`:
@@ -490,4 +512,4 @@ From here, you can:
490
512
*[Learn more about SQLMesh CLI commands](../reference/cli.md)
491
513
*[Set up a connection to a database or SQL engine](../guides/connections.md)
492
514
*[Learn more about SQLMesh concepts](../concepts/overview.md)
0 commit comments