Skip to content

Commit 46fce33

Browse files
committed
Updated CLI document output to match new CLI
1 parent 34ad12d commit 46fce33

1 file changed

Lines changed: 63 additions & 51 deletions

File tree

docs/quickstart/cli.md

Lines changed: 63 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -148,17 +148,18 @@ $ sqlmesh plan
148148
======================================================================
149149
Successfully Ran 1 tests against duckdb
150150
----------------------------------------------------------------------
151+
151152
`prod` environment will be initialized
152153

153154
Models:
154155
└── Added:
155-
├── sqlmesh_example.seed_model
156+
├── sqlmesh_example.full_model
156157
├── sqlmesh_example.incremental_model
157-
└── sqlmesh_example.full_model
158-
Models needing backfill (missing dates):
159-
├── sqlmesh_example.full_model: 2020-01-01 - 2023-05-31
160-
├── sqlmesh_example.incremental_model: 2020-01-01 - 2023-05-31
161-
└── sqlmesh_example.seed_model: 2023-05-31 - 2023-05-31
158+
└── sqlmesh_example.seed_model
159+
Models needing backfill:
160+
├── sqlmesh_example.full_model: [full refresh]
161+
├── sqlmesh_example.incremental_model: [2020-01-01 - 2025-04-15]
162+
└── sqlmesh_example.seed_model: [full refresh]
162163
Apply - Backfill Tables [y/n]:
163164
```
164165

@@ -168,10 +169,7 @@ Line 5 describes what environments the plan will affect when applied - a new `pr
168169

169170
Lines 7-11 of the output show that SQLMesh detected three new models relative to the current empty environment.
170171

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 13-16 list each model that will be executed by the plan, along with the date intervals or refresh types. Note that for incremental_model the date range [2020-01-01 - 2025-04-15] is shown, while for full_model and seed_model it indicates [full refresh]. The incremental model starts from 2020-01-01 because that date is specified in the start property of its MODEL statement, and the full model requires a full refresh because it depends on the incremental model.
175173

176174
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.
177175

@@ -254,20 +252,24 @@ Line 16 asks you whether to proceed with executing the model backfills described
254252

255253
```bash linenums="1"
256254
Apply - Backfill Tables [y/n]: y
257-
Creating physical tables ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.0% • 3/3 • 0:00:00
258255

259-
All model versions have been created successfully
256+
Updating physical layer ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.0% • 3/3 • 0:00:00
257+
258+
✔ Physical layer updated
260259

261-
[1/1] sqlmesh_example.seed_model evaluated in 0.01s
262-
[1/1] sqlmesh_example.incremental_model evaluated in 0.01s
263-
[1/1] sqlmesh_example.full_model evaluated in 0.02s
264-
Evaluating models ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.0% • 3/3 • 0:00:00
260+
[1/1] sqlmesh_example.seed_model [insert seed file]
261+
0.01s
262+
[1/1] sqlmesh_example.incremental_model [insert 2020-01-01 - 2025-04-15]
263+
0.03s
264+
[1/1] sqlmesh_example.full_model [full refresh, audits ✔1]
265+
0.03s
266+
Executing model batches ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.0% • 3/3 • 0:00:00
265267

266-
All model batches have been executed successfully
268+
✔ Model batches executed
267269

268-
Virtually Updating 'prod' ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.0% • 0:00:00
270+
Updating virtual layer ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.0% • 3/3 • 0:00:00
269271

270-
The target environment has been updated successfully
272+
✔ Virtual layer updated
271273
```
272274

273275
SQLMesh performs three actions when applying the plan:
@@ -327,32 +329,35 @@ Successfully Ran 1 tests against duckdb
327329

328330
New environment `dev` will be created from `prod`
329331

332+
330333
Differences from the `prod` environment:
331334

332335
Models:
333336
├── Directly Modified:
334337
│ └── sqlmesh_example__dev.incremental_model
335338
└── Indirectly Modified:
336339
└── sqlmesh_example__dev.full_model
337-
---
338-
339-
+++
340-
341-
@@ -10,6 +10,7 @@
342340

341+
---
342+
343+
+++
344+
345+
@@ -14,6 +14,7 @@
346+
343347
SELECT
344-
id,
345-
item_id,
348+
id,
349+
item_id,
346350
+ 'z' AS new_column,
347-
event_date
351+
event_date
348352
FROM sqlmesh_example.seed_model
349353
WHERE
354+
350355
Directly Modified: sqlmesh_example__dev.incremental_model (Non-breaking)
351356
└── Indirectly Modified Children:
352357
└── sqlmesh_example__dev.full_model (Indirect Non-breaking)
353358
Models needing backfill:
354-
└── sqlmesh_example__dev.incremental_model: [2020-01-01 - 2023-05-31]
355-
Apply - Backfill Tables [y/n]: y
359+
└── sqlmesh_example__dev.incremental_model: [2020-01-01 - 2025-04-15]
360+
Apply - Backfill Tables [y/n]:
356361
```
357362

358363
Line 6 of the output states that a new environment `dev` will be created from the existing `prod` environment.
@@ -365,21 +370,23 @@ Enter `y` at the prompt and press `Enter` to apply the plan and execute the back
365370

366371
```bash linenums="1"
367372
Apply - Backfill Tables [y/n]: y
368-
Creating physical tables ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.0% • 2/2 • 0:00:00
369373

370-
Model versions created successfully
374+
Updating physical layer ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.0% • 2/2 • 0:00:00
375+
376+
✔ Physical layer updated
371377

372-
[1/1] sqlmesh_example__dev.incremental_model evaluated in 0.01s
373-
Evaluating models ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.0% • 1/1 • 0:00:00
378+
[1/1] sqlmesh_example__dev.incremental_model [insert 2020-01-01 - 2025-04-15]
379+
0.03s
380+
Executing model batches ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.0% • 1/1 • 0:00:00
374381

375-
Model batches executed successfully
382+
Model batches executed
376383

377-
Virtually Updating 'dev' ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.0% • 0:00:00
384+
Updating virtual layer ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.0% • 2/2 • 0:00:00
378385

379-
Target environment updated successfully
386+
✔ Virtual layer updated
380387
```
381388

382-
Line 6 of the output shows that SQLMesh applied the change and evaluated `sqlmesh_example__dev.incremental_model`.
389+
Lines 6-9 show the progress of updating the physical layer. Line 8 shows that SQLMesh applied the change and evaluated sqlmesh_example__dev.incremental_model for the date range from 2020-01-01 to 2025-04-15. Lines 11-14 show the execution of model batches, and lines 17-20 show the update of the virtual layer.
383390

384391
SQLMesh did not need to backfill anything for the `full_model` since the change was `Non-breaking`.
385392

@@ -432,38 +439,43 @@ $ sqlmesh plan
432439
======================================================================
433440
Successfully Ran 1 tests against duckdb
434441
----------------------------------------------------------------------
442+
435443
Differences from the `prod` environment:
436444

437445
Models:
438446
├── Directly Modified:
439447
│ └── sqlmesh_example.incremental_model
440448
└── Indirectly Modified:
441449
└── sqlmesh_example.full_model
442-
---
443-
444-
+++
445-
446-
@@ -10,6 +10,7 @@
447450

451+
---
452+
453+
+++
454+
455+
@@ -14,6 +14,7 @@
456+
448457
SELECT
449-
id,
450-
item_id,
458+
id,
459+
item_id,
451460
+ 'z' AS new_column,
452-
event_date
461+
event_date
453462
FROM sqlmesh_example.seed_model
454463
WHERE
464+
455465
Directly Modified: sqlmesh_example.incremental_model (Non-breaking)
456466
└── Indirectly Modified Children:
457-
└── sqlmesh_example.full_model (Indirect Non-breaking)
458-
Apply - Virtual Update [y/n]: y
459-
Virtually Updating 'prod' ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.0% • 0:00:00
467+
└── sqlmesh_example.full_model (Indirect Non-breaking)
468+
Apply - Virtual Update [y/n]:
469+
SKIP: No physical layer updates to perform
470+
471+
SKIP: No model batches to execute
460472

461-
Target environment updated successfully
473+
Updating virtual layer ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100.0% • 2/2 • 0:00:00
462474

463-
Virtual Update executed successfully
475+
Virtual layer updated
464476
```
465477

466-
Note that a backfill was not necessary and only a Virtual Update occurred.
478+
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.
467479

468480
### 5.2 Validate updates in prod
469481
Double-check that the data updated in `prod` by running `sqlmesh fetchdf "select * from sqlmesh_example.incremental_model"`:

0 commit comments

Comments
 (0)