sqlbuild-cli 0.156.0__py3-none-macosx_10_12_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
@@ -0,0 +1,241 @@
1
+ Metadata-Version: 2.4
2
+ Name: sqlbuild-cli
3
+ Version: 0.156.0
4
+ License-File: LICENSE
5
+ Summary: The native sqb and sqlbuild executables of SQLBuild
6
+ License-Expression: Apache-2.0
7
+ Requires-Python: >=3.12, <3.15
8
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
9
+
10
+ <p align="center">
11
+ <img src="https://raw.githubusercontent.com/chio-labs/sqlbuild/main/.github/sqlbuild-logo-clean.png" alt="SQLBuild" width="100%">
12
+ </p>
13
+
14
+ <p align="center">
15
+ <strong>The refactorable warehouse.</strong> Verify early, test properly, and refactor safely.
16
+ </p>
17
+
18
+ <p align="center">
19
+ <a href="https://sqlbuild.com">Website</a> ·
20
+ <a href="https://sqlbuild.com/docs/">Docs</a> ·
21
+ <a href="https://sqlbuild.com/docs/quickstart/">Quickstart</a> ·
22
+ <a href="https://sqlbuild.com/docs/roadmap/">Roadmap</a>
23
+ </p>
24
+
25
+ Change your warehouse as often as your code. SQLBuild brings compile-time checks, end-to-end tests
26
+ and safe renames to your SQL, so change stops being risky. It is a free, open-source framework for
27
+ SQL and Python data pipelines, and it keeps its state in append-only tables in your own warehouse:
28
+ no external state database, no manifest files and no paid tier.
29
+
30
+ <p align="center">
31
+ <img src="https://raw.githubusercontent.com/chio-labs/sqlbuild/main/.github/demos/rename.gif" alt="Moving and renaming an incremental model with sqb mv: sqb plan migrates the existing table instead of rebuilding it" width="100%">
32
+ </p>
33
+
34
+ Move an incremental model to a new folder and name with `sqb mv`, and `sqb plan` migrates its table
35
+ instead of rebuilding it.
36
+
37
+ ## Quick start
38
+
39
+ ```bash
40
+ pip install sqlbuild
41
+ sqb playground waffle-shop
42
+ cd waffle-shop
43
+ sqb plan
44
+ sqb build
45
+ sqb test
46
+ ```
47
+
48
+ The playground runs on local DuckDB, with no warehouse credentials.
49
+
50
+ ## What it does
51
+
52
+ ### Catch mistakes before anything runs
53
+
54
+ - **Compile-time checks.** SQLBuild resolves references, validates SQL, infers column types, checks
55
+ [contracts](https://sqlbuild.com/docs/concepts/models/contracts/) and computes column lineage,
56
+ all offline. A typo'd column fails in seconds, not halfway through a warehouse run.
57
+ - **Your conventions as rules.** Built-in and custom Python
58
+ [rules](https://sqlbuild.com/docs/concepts/rules/) turn review comments into compile errors: for
59
+ example, marts can't read sources directly, or every final model declares its key.
60
+
61
+ ### Prove it works
62
+
63
+ - **Tests across models.** SQL [tests](https://sqlbuild.com/docs/concepts/testing/) mock the
64
+ sources and check the result through every model in between, with macros as test helpers. Macro,
65
+ UDF and table-function tests are built in.
66
+ - **End-to-end scenarios.** Build the real graph against fixture data, capture fixtures from the
67
+ warehouse, and replay them locally on DuckDB in CI.
68
+ See [scenarios](https://sqlbuild.com/docs/concepts/scenarios/).
69
+ - **Audits and diffs.** Audits run before data reaches the target table, and
70
+ [data diffs](https://sqlbuild.com/docs/concepts/diff/) compare dev against prod or any query.
71
+
72
+ ### Change it without rebuilding everything
73
+
74
+ - **Renames keep their history.** [`sqb rename` and `sqb mv`](https://sqlbuild.com/docs/cli/rename/)
75
+ update every reference, and the next build
76
+ [migrates](https://sqlbuild.com/docs/concepts/models/migrations/) the existing table instead of
77
+ rebuilding it. The old name keeps working through a compatibility view.
78
+ `sqb rename <model>.<column>` renames an incremental model's column in place.
79
+ - **Replay on change.** When a model's SQL changes, choose how far back to reprocess, from only the
80
+ new data to the last 14 days to a full rebuild, with
81
+ [`replay_on_change`](https://sqlbuild.com/docs/concepts/incremental/#replay-on-change).
82
+ - **Macros don't have to be global.** Keep macros, enums and constants next to the models that use
83
+ them, and preview what a move would break with `sqb scope`. See
84
+ [declaration scopes](https://sqlbuild.com/docs/concepts/declaration-scopes/).
85
+ - **Tidy up safely.** The [janitor](https://sqlbuild.com/docs/cli/janitor/) archives stale tables
86
+ before anything is deleted.
87
+
88
+ Ingestion with Python loaders, and Python tasks, assets and checks, run in the same graph as your SQL
89
+ models. See the [docs](https://sqlbuild.com/docs/) for everything else.
90
+
91
+ ## In the terminal
92
+
93
+ Each demo is real output from the example projects in [`website/examples`](website/examples),
94
+ running on local DuckDB.
95
+
96
+ ### A renamed column breaks the contract
97
+
98
+ `daily_revenue` declares `contract enforced`. Renaming `waffles_sold` to `units_sold` in the
99
+ `SELECT` fails at compile time, before anything reaches the warehouse.
100
+
101
+ <p align="center">
102
+ <img src="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%">
103
+ </p>
104
+
105
+ Both sides are reported: the new column isn't in the contract, and the declared one is gone.
106
+
107
+ ### Your own conventions as compile errors
108
+
109
+ Rules are Python functions in your project. This one, from
110
+ [`rules/layers.py`](website/examples/waffle-shop/rules/layers.py), says marts must read sources
111
+ through staging:
112
+
113
+ ```python
114
+ from sqlbuild.rules import Finding, Model, RuleContext, rule
115
+
116
+
117
+ @rule(
118
+ code="XSQBRARCH001",
119
+ message="Marts must read sources through staging",
120
+ remediation="Reference a staging model with __ref() instead.",
121
+ )
122
+ def marts_use_staging(*, model: Model, ctx: RuleContext) -> list[Finding]:
123
+ layer = ctx.project.tree.relative_parts(path=model.path, under="models")[0]
124
+ sql = ctx.sql.for_model(model).authored.source
125
+ if layer != "marts" or "__source(" not in sql:
126
+ return []
127
+ line = sql[: sql.index("__source(")].count("\n") + 1
128
+ return [ctx.finding(subject=model, line=line)]
129
+ ```
130
+
131
+ A mart that reads `__source("raw__payments")` directly now fails, and so does the unit test that
132
+ has no mock for it:
133
+
134
+ <p align="center">
135
+ <img src="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%">
136
+ </p>
137
+
138
+ See [rules](https://sqlbuild.com/docs/concepts/rules/).
139
+
140
+ ### See what a move would break
141
+
142
+ `sqb scope --as-path` previews moving a model before you move it.
143
+
144
+ <p align="center">
145
+ <img src="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%">
146
+ </p>
147
+
148
+ Look at `Lost` and `Invalidated usages`: the model uses an enum and a macro that are private to
149
+ `models/marts`, so moving it would break both.
150
+
151
+ ## Example
152
+
153
+ A model is a SQL file with a `MODEL()` header and a `SELECT`:
154
+
155
+ ```sql
156
+ MODEL (
157
+ description "One row per order",
158
+ materialized table,
159
+ columns (
160
+ order_id (audits [not_null, unique]),
161
+ ),
162
+ tags [marts],
163
+ );
164
+
165
+ SELECT
166
+ o.order_id,
167
+ o.customer_id,
168
+ p.amount_cents AS total_cents,
169
+ @cents_to_dollars("p.amount_cents") AS total_dollars
170
+ FROM __ref("stg_orders") o
171
+ JOIN __ref("stg_payments") p USING (order_id)
172
+ ```
173
+
174
+ Macros are plain Python functions that return SQL, kept next to the models that use them:
175
+
176
+ ```python
177
+ # models/marts/_sqlbuild/_macros/currency.py
178
+ def cents_to_dollars(column: str) -> str:
179
+ """Convert a cents integer column to a dollars decimal with two decimal places."""
180
+ return f"ROUND(({column}) / 100.0, 2)"
181
+ ```
182
+
183
+ A test mocks the sources and asserts on the model, resolving every model in between from its real
184
+ SQL:
185
+
186
+ ```sql
187
+ TEST();
188
+
189
+ WITH
190
+ __source__raw__orders AS (
191
+ SELECT
192
+ 1 AS id,
193
+ 100 AS customer_id,
194
+ 2 AS waffle_type_id,
195
+ 3 AS quantity,
196
+ CAST('2026-04-01 10:00:00' AS TIMESTAMP) AS ordered_at,
197
+ 'completed' AS status
198
+ ),
199
+ __source__raw__payments AS (
200
+ SELECT
201
+ 10 AS id,
202
+ 1 AS order_id,
203
+ 1500 AS amount_cents,
204
+ 'credit_card' AS payment_method,
205
+ CAST('2026-04-01 10:05:00' AS TIMESTAMP) AS paid_at,
206
+ 'success' AS status
207
+ ),
208
+ __expected__fact_orders AS (
209
+ SELECT 1 AS order_id, 100 AS customer_id, 1500 AS total_cents, 15.00 AS total_dollars
210
+ )
211
+ ```
212
+
213
+ ## Warehouses
214
+
215
+ | Warehouse | Status |
216
+ |-----------|--------|
217
+ | Snowflake | Supported |
218
+ | DuckDB | Supported |
219
+ | MotherDuck | Supported |
220
+ | PostgreSQL | Supported |
221
+ | BigQuery | Beta |
222
+ | Databricks | Beta |
223
+ | SQL Server | Beta |
224
+
225
+ Snowflake is the main target. Beta adapters build, test and plan, but have had less production use
226
+ so far. See [adapters](https://sqlbuild.com/docs/concepts/adapters/).
227
+
228
+ ## Free and independent
229
+
230
+ SQLBuild is Apache 2.0 and will stay free: no paid tier, no commercial edition, and no feature held
231
+ back for one. Its state lives in your warehouse, next to your data. See the
232
+ [roadmap](https://sqlbuild.com/docs/roadmap/) for what's next.
233
+
234
+ ## Contributing
235
+
236
+ Contributions are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md).
237
+
238
+ ## License
239
+
240
+ SQLBuild is licensed under the [Apache License 2.0](LICENSE).
241
+
@@ -0,0 +1,7 @@
1
+ sqlbuild_cli-0.156.0.data/scripts/sqb,sha256=4G_A0R5RXsd2u2iuW_Su0u3WNbP5XsTCGhkp-RvCZl0,1135136
2
+ sqlbuild_cli-0.156.0.data/scripts/sqlbuild,sha256=zShq9sxs8Ph9wWMp5Tz-IUJ-4zyUnapvzEsRpbe4nVo,1135136
3
+ sqlbuild_cli-0.156.0.dist-info/METADATA,sha256=HXOrLbyxZRqNlUy9mb37htcaAggWl5ENj_wUmw7-oDM,8937
4
+ sqlbuild_cli-0.156.0.dist-info/WHEEL,sha256=lydvCcUfNMjZsH7TcDaQbgngdhXqm4ws-SEf1zfNtck,104
5
+ sqlbuild_cli-0.156.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
6
+ sqlbuild_cli-0.156.0.dist-info/sboms/sqlbuild-cli.cyclonedx.json,sha256=8AAEbIRCkaGaQHZ1i0pbMCJ2LbzP4p9Odvf1xRka9BM,70933
7
+ sqlbuild_cli-0.156.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: maturin (1.15.0)
3
+ Root-Is-Purelib: false
4
+ Tag: py3-none-macosx_10_12_x86_64
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.