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
Copy file name to clipboardExpand all lines: docs/quickstart/cli.md
+73-73Lines changed: 73 additions & 73 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -288,6 +288,78 @@ SQLMesh's key actions are creating and applying *plans* to *environments*. At th
288
288
289
289
After SQLMesh creates a plan, it summarizes the breaking and non-breaking changes so you can understand what will happen if you apply the plan. It will prompt you to "backfill" data to apply the plan. (In this context, backfill is a generic term for updating or adding to a table's data, including an initial load or full refresh.)
290
290
291
+
??? info "Learn more about a plan's actions: `sqlmesh plan --explain`"
292
+
293
+
Before applying a plan, you can view a detailed description of the actions it will take by passing the explain flag in your `sqlmesh plan` command:
294
+
295
+
```bash
296
+
sqlmesh plan --explain
297
+
```
298
+
299
+
Passing the explain flag for the quickstart example project above adds the following information to the output:
300
+
301
+
```bash
302
+
Explained plan
303
+
├── Validate SQL and create physical layer tables and views if they do not exist
│ ├── Dry run model query without inserting results
339
+
│ └── Create table if it doesn't exist
340
+
```
341
+
342
+
The first line shows the model name `sqlmesh_example.seed_model` and the physical layer table SQLMesh will create to store its data: `db.sqlmesh__sqlmesh_example.sqlmesh_example__seed_model__2185867172`. The second and third lines tell us that in this step SQLMesh will dry-run the model query and create the physical layer table if it doesn't exist.
343
+
344
+
The second section describes what will occur during the backfill step. The second model in this section is:
The first line shows the model name `sqlmesh_example.full_model` and the physical layer table SQLMesh will insert the model's data into: `db.sqlmesh__sqlmesh_example.sqlmesh_example__full_model__2278521865`. The second and third lines tell us that the backfill action will fully refresh the model's physical table and run the `assert_positive_order_ids` audit.
353
+
354
+
The final section describes SQLMesh's action during the virtual layer update step. The first model in this section is:
355
+
356
+
```bash
357
+
└── Create or update views in the virtual layer to point at new physical tables and views
The virtual layer step will update the `sqlmesh_example.full_model` virtual layer view to `SELECT * FROM` the physical table `db.sqlmesh__sqlmesh_example.sqlmesh_example__full_model__2278521865`.
362
+
291
363
The first SQLMesh plan must execute every model to populate the production environment. Running `sqlmesh plan` will generate the plan and the following output:
292
364
293
365
```bash linenums="1"
@@ -428,79 +500,7 @@ Lines 12-14 show the progress and completion of the second step - executing mode
428
500
429
501
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.
430
502
431
-
??? "Learn more about the plan's actions: `sqlmesh plan --explain`"
432
-
433
-
Before applying a plan, you can view a detailed description of the actions it will take by passing the explain flag in your `sqlmesh plan` command:
434
-
435
-
```bash
436
-
sqlmesh plan --explain
437
-
```
438
-
439
-
Passing the explain flag for the quickstart example project above adds the following information to the output:
440
-
441
-
```bash
442
-
Explained plan
443
-
├── Validate SQL and create physical layer tables and views if they do not exist
│ ├── Dry run model query without inserting results
479
-
│ └── Create table if it doesn't exist
480
-
```
481
-
482
-
The first line shows the model name `sqlmesh_example.seed_model` and the physical layer table SQLMesh will create to store its data: `db.sqlmesh__sqlmesh_example.sqlmesh_example__seed_model__2185867172`. The second and third lines tell us that in this step SQLMesh will dry-run the model query and create the physical layer table if it doesn't exist.
483
-
484
-
The second section describes what will occur during the backfill step. The second model in this section is:
The first line shows the model name `sqlmesh_example.full_model` and the physical layer table SQLMesh will insert the model's data into: `db.sqlmesh__sqlmesh_example.sqlmesh_example__full_model__2278521865`. The second and third lines tell us that the backfill action will fully refresh the model's physical table and run the `assert_positive_order_ids` audit.
493
-
494
-
The final section describes SQLMesh's action during the virtual layer update step. The first model in this section is:
495
-
496
-
```bash
497
-
└── Create or update views in the virtual layer to point at new physical tables and views
The virtual layer step will update the `sqlmesh_example.full_model` virtual layer view to `SELECT * FROM` the physical table `db.sqlmesh__sqlmesh_example.sqlmesh_example__full_model__2278521865`.
502
-
503
-
Let's take a quick look at the project's DuckDB database file to see the objects SQLMesh created. First, we open the built-in DuckDB CLI tool with the `duckdb db.db` command, then run our two queries:
503
+
Let's take a quick look at the project's DuckDB database file to see the objects SQLMesh created. First, we open the built-in DuckDB CLI tool with the `duckdb db.db` command, then run our two queries.
504
504
505
505
Our first query shows the three physical tables SQLMesh created in the `sqlmesh__sqlmesh_example` schema (one table for each model):
0 commit comments