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
{{ message }}
Repository navigation
Commit b274479
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: README.md
+41-3Lines changed: 41 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,6 +22,9 @@ manifest files and no paid tier.
22
22
<imgsrc="https://raw.githubusercontent.com/chio-labs/sqlbuild/main/.github/demos/rename.gif"alt="Moving and renaming an incremental model: sqb plan migrates the existing table instead of rebuilding it"width="100%">
23
23
</p>
24
24
25
+
Move an incremental model to a new folder and name, and `sqb plan` migrates its table instead of
26
+
rebuilding it.
27
+
25
28
## Quick start
26
29
27
30
```bash
@@ -71,12 +74,47 @@ The playground runs on local DuckDB, with no warehouse credentials.
71
74
-**Tidy up safely.** The [janitor](https://sqlbuild.com/docs/cli/janitor/) archives stale tables
72
75
before anything is deleted.
73
76
77
+
Ingestion with Python loaders, and Python tasks, assets and checks, run in the same graph as your SQL
78
+
models. See the [docs](https://sqlbuild.com/docs/) for everything else.
79
+
80
+
## In the terminal
81
+
82
+
Each demo runs on local DuckDB with the projects in [`website/examples`](website/examples). The
83
+
tapes that record them are in [`website/recordings`](website/recordings).
84
+
85
+
### A renamed column breaks the contract
86
+
87
+
`daily_revenue` declares `contract enforced`. Renaming `waffles_sold` to `units_sold` in the
88
+
`SELECT` fails at compile time, before anything reaches the warehouse.
89
+
74
90
<palign="center">
75
-
<imgsrc="https://raw.githubusercontent.com/chio-labs/sqlbuild/main/.github/demos/scope.gif"alt="sqb scope previews a move: the enum and macro the model uses would be lost, so the move is flagged before anything breaks"width="100%">
91
+
<imgsrc="https://raw.githubusercontent.com/chio-labs/sqlbuild/main/.github/demos/contract.gif"alt="sqb compile fails because units_sold is not in the enforced contract and the declared waffles_sold column is missing"width="100%">
76
92
</p>
77
93
78
-
Ingestion with Python loaders, and Python tasks, assets and checks, run in the same graph as your SQL
79
-
models. See the [docs](https://sqlbuild.com/docs/) for everything else.
94
+
Both sides are reported: the new column isn't in the contract, and the declared one is gone.
95
+
96
+
### Your own conventions as compile errors
97
+
98
+
The project's rule says marts must read sources through staging. A mart that reads
99
+
`__source("raw__payments")` directly fails, and so does the unit test that has no mock for it.
100
+
101
+
<palign="center">
102
+
<imgsrc="https://raw.githubusercontent.com/chio-labs/sqlbuild/main/.github/demos/rules.gif"alt="sqb compile reports the custom rule XSQBRARCH001 on the line that reads a raw source, and a unit test with no mock for that source"width="100%">
103
+
</p>
104
+
105
+
The rule is [a short Python function](website/examples/waffle-shop/rules/layers.py). See
`sqb scope --as-path` previews moving a model before you move it.
111
+
112
+
<palign="center">
113
+
<imgsrc="https://raw.githubusercontent.com/chio-labs/sqlbuild/main/.github/demos/scope.gif"alt="sqb scope previews moving daily_revenue: the enum and macro it uses would be lost, so both usages are invalidated"width="100%">
114
+
</p>
115
+
116
+
Look at `Lost` and `Invalidated usages`: the model uses an enum and a macro that are private to
|`compile`|`sqb compile` catches an unknown column and a type mismatch. Not used yet: the column checks it shows are unreleased. |
14
15
15
-
The README uses `rename.gif` and `scope.gif`, copied into `.github/demos/`. Each demo runs locally on DuckDB, using the projects in [`../examples`](../examples).
16
+
The README uses `rename`, `contract`, `rules` and `scope`, copied into `.github/demos/`. Each demo
17
+
runs locally on DuckDB, using the projects in [`../examples`](../examples).
16
18
17
19
## Requirements
18
20
19
21
-`vhs`, `ttyd` and `ffmpeg` on `PATH`, plus a Chromium or Chrome that VHS can find (it downloads
20
22
one if none is on `PATH`).
21
23
- DejaVu Sans Mono, the font the tapes use.
24
+
-`tree` (the rename and scope tapes show folder trees).
22
25
-`sqb` on `PATH`, or `SQB_BIN` pointing at a directory that contains the `sqb` to record.
0 commit comments