Skip to content

Commit 173c504

Browse files
committed
first draft
1 parent 4c89eb0 commit 173c504

2 files changed

Lines changed: 290 additions & 0 deletions

File tree

Lines changed: 289 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,289 @@
1+
# SQLMesh CLI Crash Course
2+
3+
This doc is designed to get you intimate with 90% of the SQLMesh commands you’ll use to build *and* maintain data pipelines. The goal is after 30 minutes, using SQLMesh becomes muscle memory. This is designed to live on your second monitor or in a side by side window, so you can swiftly copy/paste into your terminal.
4+
5+
This is *not* an exhaustive list, but it is an earnest one.
6+
7+
## **Development Commands**
8+
9+
You’ll use these commands 80% of the time because this is how you apply code changes.
10+
11+
=== "SQLMesh"
12+
13+
```bash
14+
sqlmesh plan dev
15+
```
16+
17+
=== "Tobiko Cloud"
18+
19+
```bash
20+
tcloud sqlmesh plan dev
21+
```
22+
23+
asdf
24+
25+
=== "SQLMesh"
26+
27+
```bash
28+
sqlmesh plan dev --start 2025-01-01 --end now
29+
```
30+
31+
=== "Tobiko Cloud"
32+
33+
```bash
34+
tcloud sqlmesh plan dev --start 2025-01-01 --end now
35+
```
36+
37+
asdf
38+
39+
=== "SQLMesh"
40+
41+
```bash
42+
sqlmesh --debug plan dev
43+
```
44+
45+
=== "Tobiko Cloud"
46+
47+
```bash
48+
tcloud sqlmesh --debug plan dev
49+
```
50+
51+
asdf
52+
=== "SQLMesh"
53+
54+
```bash
55+
sqlmesh plan dev --auto-apply
56+
```
57+
58+
=== "Tobiko Cloud"
59+
60+
```bash
61+
tcloud sqlmesh plan dev --auto-apply # - good for iterating faster
62+
```
63+
64+
asdf
65+
66+
=== "SQLMesh"
67+
68+
```bash
69+
sqlmesh plan dev --dry-run
70+
```
71+
72+
=== "Tobiko Cloud"
73+
74+
```bash
75+
tcloud sqlmesh plan dev --dry-run
76+
```
77+
78+
asdf
79+
=== "SQLMesh"
80+
81+
```bash
82+
sqlmesh plan dev --diff-rendered
83+
```
84+
85+
=== "Tobiko Cloud"
86+
87+
```bash
88+
tcloud sqlmesh plan dev --diff-rendered
89+
```
90+
91+
asdf
92+
=== "SQLMesh"
93+
94+
```bash
95+
sqlmesh plan dev --no-diff
96+
```
97+
98+
=== "Tobiko Cloud"
99+
100+
```bash
101+
tcloud sqlmesh plan dev --no-diff
102+
```
103+
104+
asdf
105+
106+
=== "SQLMesh"
107+
108+
```bash
109+
sqlmesh plan dev --empty-backfill
110+
```
111+
112+
=== "Tobiko Cloud"
113+
114+
```bash
115+
tcloud sqlmesh plan dev --empty-backfill
116+
```
117+
118+
asdf
119+
120+
=== "SQLMesh"
121+
122+
```bash
123+
sqlmesh plan dev --forward-only
124+
```
125+
126+
=== "Tobiko Cloud"
127+
128+
```bash
129+
tcloud sqlmesh plan dev --forward-only
130+
```
131+
132+
asdf
133+
134+
=== "SQLMesh"
135+
136+
```bash
137+
sqlmesh create_external_models
138+
```
139+
140+
=== "Tobiko Cloud"
141+
142+
```bash
143+
tcloud sqlmesh create_external_models
144+
```
145+
146+
asdf
147+
148+
## **Run Commands**
149+
150+
=== "SQLMesh"
151+
152+
```bash
153+
sqlmesh run
154+
```
155+
156+
=== "Tobiko Cloud"
157+
158+
```bash
159+
tcloud sqlmesh run
160+
```
161+
162+
asdf
163+
164+
=== "SQLMesh"
165+
166+
```bash
167+
sqlmesh run dev
168+
```
169+
170+
=== "Tobiko Cloud"
171+
172+
```bash
173+
tcloud sqlmesh run dev
174+
```
175+
176+
asdf
177+
178+
=== "SQLMesh"
179+
180+
```bash
181+
sqlmesh run --ignore-cron
182+
```
183+
184+
=== "Tobiko Cloud"
185+
186+
```bash
187+
tcloud sqlmesh run --ignore-cron
188+
```
189+
190+
asdf
191+
192+
- allow_partials
193+
194+
## **Working with Incremental Forward-Only Models**
195+
196+
https://www.loom.com/share/209181d9532d44969313ac0ac23f501f
197+
198+
- codify this especially the commented out steps
199+
200+
201+
## **Validating Changes**
202+
203+
You'll these commands ad hoc to verify your changes are behaving as expected.
204+
205+
=== "SQLMesh"
206+
207+
```bash
208+
sqlmesh render sqlmesh_example.incremental_model
209+
```
210+
211+
=== "Tobiko Cloud"
212+
213+
```bash
214+
tcloud sqlmesh render sqlmesh_example.incremental_model
215+
```
216+
217+
asdf
218+
219+
=== "SQLMesh"
220+
221+
```bash
222+
sqlmesh table_diff ajwioejfioajowe
223+
```
224+
225+
=== "Tobiko Cloud"
226+
227+
```bash
228+
tcloud sqlmesh table_diff ajwioejfioajowe
229+
```
230+
231+
asdf
232+
233+
=== "SQLMesh"
234+
235+
```bash
236+
sqlmesh fetchdf "select * from tcloud_demo__dev_debug.gsheets_example_v3"
237+
```
238+
239+
=== "Tobiko Cloud"
240+
241+
```bash
242+
tcloud sqlmesh fetchdf "select * from tcloud_demo__dev_debug.gsheets_example_v3"
243+
```
244+
245+
asdf
246+
247+
=== "SQLMesh"
248+
249+
```bash
250+
sqlmesh create_test demo.stg_payments --query demo.seed_raw_payments "select * from demo.seed_raw_payments limit 5"
251+
```
252+
253+
=== "Tobiko Cloud"
254+
255+
```bash
256+
tcloud sqlmesh create_test demo.stg_payments --query demo.seed_raw_payments "select * from demo.seed_raw_payments limit 5"
257+
```
258+
259+
asdf
260+
261+
## **Miscellaneous**
262+
263+
=== "SQLMesh"
264+
265+
```bash
266+
sqlmesh migrate
267+
```
268+
269+
=== "Tobiko Cloud"
270+
271+
```bash
272+
tcloud sqlmesh migrate
273+
```
274+
275+
- migrate state schemas
276+
277+
=== "SQLMesh"
278+
279+
```bash
280+
sqlmesh janitor
281+
```
282+
283+
=== "Tobiko Cloud"
284+
285+
```bash
286+
tcloud sqlmesh janitor
287+
```
288+
289+
- Manually clean up old development schemas outside the automated schedule

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ nav:
6767
- Examples:
6868
- examples/overview.md
6969
- Walkthroughs:
70+
- examples/sqlmesh_cli_crash_course.md
7071
- examples/incremental_time_full_walkthrough.md
7172
- Integrations:
7273
- "Overview": integrations/overview.md

0 commit comments

Comments
 (0)