datalex-cli 0.1.1__py3-none-any.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.
Files changed (64) hide show
  1. datalex_cli/__init__.py +1 -0
  2. datalex_cli/datalex_cli.py +658 -0
  3. datalex_cli/main.py +2925 -0
  4. datalex_cli-0.1.1.dist-info/METADATA +228 -0
  5. datalex_cli-0.1.1.dist-info/RECORD +64 -0
  6. datalex_cli-0.1.1.dist-info/WHEEL +5 -0
  7. datalex_cli-0.1.1.dist-info/entry_points.txt +2 -0
  8. datalex_cli-0.1.1.dist-info/licenses/LICENSE +21 -0
  9. datalex_cli-0.1.1.dist-info/top_level.txt +2 -0
  10. datalex_core/__init__.py +94 -0
  11. datalex_core/_schemas/datalex/common.schema.json +127 -0
  12. datalex_core/_schemas/datalex/domain.schema.json +24 -0
  13. datalex_core/_schemas/datalex/entity.schema.json +158 -0
  14. datalex_core/_schemas/datalex/model.schema.json +141 -0
  15. datalex_core/_schemas/datalex/policy.schema.json +70 -0
  16. datalex_core/_schemas/datalex/project.schema.json +82 -0
  17. datalex_core/_schemas/datalex/snippet.schema.json +24 -0
  18. datalex_core/_schemas/datalex/source.schema.json +104 -0
  19. datalex_core/_schemas/datalex/term.schema.json +30 -0
  20. datalex_core/canonical.py +166 -0
  21. datalex_core/completion.py +204 -0
  22. datalex_core/connectors/__init__.py +39 -0
  23. datalex_core/connectors/base.py +417 -0
  24. datalex_core/connectors/bigquery.py +229 -0
  25. datalex_core/connectors/databricks.py +262 -0
  26. datalex_core/connectors/mysql.py +266 -0
  27. datalex_core/connectors/postgres.py +309 -0
  28. datalex_core/connectors/redshift.py +298 -0
  29. datalex_core/connectors/snowflake.py +336 -0
  30. datalex_core/connectors/sqlserver.py +425 -0
  31. datalex_core/datalex/__init__.py +26 -0
  32. datalex_core/datalex/diff.py +188 -0
  33. datalex_core/datalex/errors.py +85 -0
  34. datalex_core/datalex/loader.py +512 -0
  35. datalex_core/datalex/migrate_layout.py +382 -0
  36. datalex_core/datalex/parse_cache.py +102 -0
  37. datalex_core/datalex/project.py +214 -0
  38. datalex_core/datalex/types.py +224 -0
  39. datalex_core/dbt/__init__.py +18 -0
  40. datalex_core/dbt/emit.py +344 -0
  41. datalex_core/dbt/manifest.py +329 -0
  42. datalex_core/dbt/profiles.py +185 -0
  43. datalex_core/dbt/sync.py +279 -0
  44. datalex_core/dbt/warehouse.py +215 -0
  45. datalex_core/dialects/__init__.py +15 -0
  46. datalex_core/dialects/_common.py +48 -0
  47. datalex_core/dialects/base.py +47 -0
  48. datalex_core/dialects/postgres.py +164 -0
  49. datalex_core/dialects/registry.py +36 -0
  50. datalex_core/dialects/snowflake.py +129 -0
  51. datalex_core/diffing.py +358 -0
  52. datalex_core/docs_generator.py +797 -0
  53. datalex_core/doctor.py +181 -0
  54. datalex_core/generators.py +478 -0
  55. datalex_core/importers.py +1176 -0
  56. datalex_core/issues.py +23 -0
  57. datalex_core/loader.py +21 -0
  58. datalex_core/migrate.py +316 -0
  59. datalex_core/modeling.py +679 -0
  60. datalex_core/packages.py +430 -0
  61. datalex_core/policy.py +1037 -0
  62. datalex_core/resolver.py +456 -0
  63. datalex_core/schema.py +54 -0
  64. datalex_core/semantic.py +1561 -0
@@ -0,0 +1,228 @@
1
+ Metadata-Version: 2.4
2
+ Name: datalex-cli
3
+ Version: 0.1.1
4
+ Summary: Git-native data modeling for dbt users
5
+ Author-email: DuckCode AI Labs <hello@duckcode.ai>
6
+ License: MIT
7
+ Project-URL: Homepage, https://duckcode.ai
8
+ Project-URL: Repository, https://github.com/duckcode-ai/DataLex
9
+ Project-URL: Issues, https://github.com/duckcode-ai/DataLex/issues
10
+ Keywords: dbt,data-modeling,yaml,git-native,erd,data-warehouse
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Database
20
+ Classifier: Topic :: Software Development :: Code Generators
21
+ Requires-Python: >=3.9
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: PyYAML>=6.0
25
+ Requires-Dist: jsonschema>=4.0
26
+ Provides-Extra: duckdb
27
+ Requires-Dist: duckdb>=0.9; extra == "duckdb"
28
+ Provides-Extra: postgres
29
+ Requires-Dist: psycopg2-binary; extra == "postgres"
30
+ Provides-Extra: mysql
31
+ Requires-Dist: mysql-connector-python; extra == "mysql"
32
+ Provides-Extra: snowflake
33
+ Requires-Dist: snowflake-connector-python; extra == "snowflake"
34
+ Provides-Extra: bigquery
35
+ Requires-Dist: google-cloud-bigquery; extra == "bigquery"
36
+ Provides-Extra: databricks
37
+ Requires-Dist: databricks-sql-connector; extra == "databricks"
38
+ Provides-Extra: sqlserver
39
+ Requires-Dist: pyodbc; extra == "sqlserver"
40
+ Provides-Extra: redshift
41
+ Requires-Dist: redshift-connector; extra == "redshift"
42
+ Provides-Extra: all
43
+ Requires-Dist: duckdb>=0.9; extra == "all"
44
+ Requires-Dist: psycopg2-binary; extra == "all"
45
+ Requires-Dist: mysql-connector-python; extra == "all"
46
+ Requires-Dist: snowflake-connector-python; extra == "all"
47
+ Requires-Dist: google-cloud-bigquery; extra == "all"
48
+ Requires-Dist: databricks-sql-connector; extra == "all"
49
+ Requires-Dist: pyodbc; extra == "all"
50
+ Requires-Dist: redshift-connector; extra == "all"
51
+ Dynamic: license-file
52
+
53
+ <div align="center">
54
+ <a href="https://duckcode.ai/" target="_blank" rel="noopener noreferrer">
55
+ <img src="Assets/DataLex.png" alt="DataLex by DuckCode AI Labs" width="220" />
56
+ </a>
57
+
58
+ # DataLex
59
+
60
+ **Git-native data modeling for dbt users.**
61
+
62
+ Point us at your dbt project and warehouse — we produce versioned, reviewable YAML
63
+ with contracts, lineage, ERDs, and clean round-trip back to dbt.
64
+
65
+ <p align="center">
66
+ <a href="https://github.com/duckcode-ai/DataLex/blob/main/LICENSE">
67
+ <img src="https://img.shields.io/github/license/duckcode-ai/DataLex?style=for-the-badge&color=22c55e" alt="MIT License" />
68
+ </a>
69
+ <a href="https://discord.gg/Dnm6bUvk">
70
+ <img src="https://img.shields.io/badge/Discord-Join%20Community-5865F2?style=for-the-badge&logo=discord&logoColor=white" alt="Discord Community" />
71
+ </a>
72
+ <a href="https://github.com/duckcode-ai/DataLex/stargazers">
73
+ <img src="https://img.shields.io/github/stars/duckcode-ai/DataLex?style=for-the-badge&color=f59e0b" alt="GitHub Stars" />
74
+ </a>
75
+ </p>
76
+ </div>
77
+
78
+ <p align="center">
79
+ <img src="Assets/Overview.png" alt="DataLex Visual Studio — file tree, YAML editor, and React Flow ERD on the same entity" width="100%" />
80
+ </p>
81
+
82
+ ## 60-second demo
83
+
84
+ ```bash
85
+ git clone https://github.com/duckcode-ai/DataLex.git
86
+ cd DataLex
87
+ pip install -e '.[duckdb]'
88
+
89
+ # 1. Build a local DuckDB warehouse (no external credentials)
90
+ python examples/jaffle_shop_demo/setup.py
91
+
92
+ # 2. Sync the dbt project into DataLex YAML
93
+ ./datalex datalex dbt sync examples/jaffle_shop_demo \
94
+ --out-root examples/jaffle_shop_demo/datalex-out
95
+
96
+ # 3. Emit dbt-parseable YAML back, with contracts enforced
97
+ ./datalex datalex dbt emit examples/jaffle_shop_demo/datalex-out \
98
+ --out-dir examples/jaffle_shop_demo/dbt-out
99
+ ```
100
+
101
+ Open `examples/jaffle_shop_demo/datalex-out/sources/jaffle_shop_raw.yaml` —
102
+ every column has its warehouse type, descriptions from the manifest, and a
103
+ `meta.datalex.dbt.unique_id` stamp so re-running the sync never clobbers
104
+ anything you've hand-authored.
105
+
106
+ ## What it does
107
+
108
+ DataLex treats your data models as code. On top of a stricter YAML
109
+ substrate (the **DataLex** layout — one file per entity, `kind:`-dispatched,
110
+ streaming-safe for 10K+ entities), it gives you:
111
+
112
+ - **`datalex datalex dbt sync <project>`** — reads `target/manifest.json` + your
113
+ `profiles.yml`, introspects live column types, and merges them into
114
+ DataLex YAML. Idempotent: user-authored `description:`, `tags:`,
115
+ `sensitivity:`, and `tests:` survive re-sync.
116
+ - **`datalex datalex dbt emit`** — writes `sources.yml` and `schema.yml` with
117
+ `contract.enforced: true` and `data_type:` on every column. `dbt parse`
118
+ succeeds out of the box.
119
+ - **`datalex datalex emit ddl --dialect ...`** — Postgres, Snowflake, BigQuery,
120
+ Databricks, MySQL, SQL Server, Redshift. Same source, all dialects.
121
+ - **`datalex datalex diff`** — semantic diff with explicit rename tracking
122
+ (`previous_name:`), breaking-change gate for CI.
123
+ - **Cross-repo package imports** — pin `acme/warehouse-core@1.4.0` in
124
+ `imports:`, lockfile + content hash drift detection, Git-or-path
125
+ resolution, on-disk parse cache for large projects.
126
+ - **Visual studio** — React Flow UI for editing entities, relationships,
127
+ and metadata; same YAML files as the CLI.
128
+
129
+ ## Supported warehouses
130
+
131
+ | Warehouse | `dbt sync` introspection | Forward DDL | Reverse engineering |
132
+ |---|:---:|:---:|:---:|
133
+ | DuckDB | ✓ | — | — |
134
+ | PostgreSQL | ✓ | ✓ | ✓ |
135
+ | Snowflake | (fallback) | ✓ | ✓ |
136
+ | BigQuery | (fallback) | ✓ | ✓ |
137
+ | Databricks | (fallback) | ✓ | ✓ |
138
+ | MySQL | (fallback) | ✓ | ✓ |
139
+ | SQL Server / Azure SQL | (fallback) | ✓ | ✓ |
140
+ | Redshift | (fallback) | ✓ | ✓ |
141
+
142
+ "Fallback" = uses the existing full-schema connector (slower than the
143
+ per-table path but already works today; a narrow introspection path ships
144
+ per-dialect over time).
145
+
146
+ ## Install
147
+
148
+ ```bash
149
+ git clone https://github.com/duckcode-ai/DataLex.git
150
+ cd DataLex
151
+
152
+ python3 -m venv .venv
153
+ source .venv/bin/activate
154
+ pip install -e . # puts `datalex` on PATH
155
+ pip install -e '.[duckdb]' # add warehouse drivers you need
156
+
157
+ # optional — only needed for the Visual Studio
158
+ npm --prefix packages/api-server install
159
+ npm --prefix packages/web-app install
160
+ ```
161
+
162
+ Available extras: `duckdb`, `postgres`, `mysql`, `snowflake`,
163
+ `bigquery`, `databricks`, `sqlserver`, `redshift`, or `all`.
164
+
165
+ Prereqs: Python 3.9+, Git. Node.js 18+ if you want the UI.
166
+
167
+ ## Project layout
168
+
169
+ ```text
170
+ DataLex/
171
+ packages/
172
+ core_engine/ # Python: loader, dialects, dbt integration, packages
173
+ src/datalex_core/
174
+ _schemas/datalex/ # JSON Schema per `kind:` — bundled with the package
175
+ cli/ # `datalex` entry point
176
+ api-server/ # Node.js API (UI backend)
177
+ web-app/ # React Flow studio
178
+ examples/
179
+ jaffle_shop_demo/ # zero-setup dbt-sync demo (DuckDB)
180
+ model-examples/ # sample projects and scenario walkthroughs
181
+ docs/ # architecture, specs, runbooks
182
+ tests/ # unittest suite (core engine + datalex)
183
+ ```
184
+
185
+ ## Visual Studio (optional)
186
+
187
+ If you want the UI on top of your DataLex project, run the two dev servers:
188
+
189
+ ```bash
190
+ # Terminal 1
191
+ npm --prefix packages/api-server run dev
192
+ # Terminal 2
193
+ npm --prefix packages/web-app run dev
194
+ ```
195
+
196
+ Then open `http://localhost:5173`. The UI reads and writes the same YAML
197
+ files the CLI does — no database, no hosted service.
198
+
199
+ ## CI / GitOps
200
+
201
+ DataLex is designed to live in your repo next to your dbt project.
202
+ A typical CI step:
203
+
204
+ ```bash
205
+ ./datalex datalex validate datalex/
206
+ ./datalex datalex diff datalex-main/ datalex/ --exit-on-breaking
207
+ ./datalex datalex dbt emit datalex/ --out-dir dbt/
208
+ dbt parse
209
+ ```
210
+
211
+ ## Documentation
212
+
213
+ - **[Tutorial: dbt sync in 5 minutes](docs/tutorial-dbt-sync.md)** — the
214
+ full jaffle_shop walkthrough with explanations.
215
+ - **[DataLex layout reference](docs/datalex-layout.md)** — what each
216
+ `kind:` file looks like and how the loader discovers them.
217
+ - **[CLI cheat sheet](docs/cli.md)** — every `datalex datalex …` subcommand on
218
+ one page.
219
+ - **[Architecture](docs/architecture.md)** — core engine modules and
220
+ end-to-end data flow.
221
+ - Pre-DataLex specs have moved to [docs/archive/](docs/archive/).
222
+
223
+ ## Community
224
+
225
+ - Discord: [![Join Discord](https://img.shields.io/badge/Discord-Join%20DuckCode%20AI-5865F2?logo=discord&logoColor=white)](https://discord.gg/Dnm6bUvk)
226
+ - Issues: [![GitHub Issues](https://img.shields.io/badge/Issues-Report%20or%20Request-0ea5e9)](https://github.com/duckcode-ai/DataLex/issues)
227
+ - Contributing: `CONTRIBUTING.md`
228
+ - License: [![MIT](https://img.shields.io/badge/License-MIT-22c55e?style=flat-square)](LICENSE)
@@ -0,0 +1,64 @@
1
+ datalex_cli/__init__.py,sha256=CBbUACIZ9fDqHyawV0txWNY92wLUe_nYteMblNPYUes,21
2
+ datalex_cli/datalex_cli.py,sha256=oK3cpDJ2TiIgjL0TH05WupQINW-MkiCMHCUI_o9iQmU,22879
3
+ datalex_cli/main.py,sha256=PqJmt1Oj9a-i0CrMCMAWA62yfnYUwjyBjTeb0VjBKH0,113411
4
+ datalex_cli-0.1.1.dist-info/licenses/LICENSE,sha256=j6Xcaimk1_Rpcri1CmvfAS7ENSKo5omtdLu3jpSYkAg,1068
5
+ datalex_core/__init__.py,sha256=DRcxrqpL15IPBNJARIbK_ZhmyltxNN5lbChcuP0uHuc,2724
6
+ datalex_core/canonical.py,sha256=ChcZR5AVnXursWgNwzGQ35OQ4dls6vQG5sQtz0pnhsg,7361
7
+ datalex_core/completion.py,sha256=2TzguA6QKbDIOF8KCgD3icpQYeyiecHmSEY7p3Pr2_I,6346
8
+ datalex_core/diffing.py,sha256=wPbahRu7BNDm9j9MjhNEzodeQfZq-drTPtT1qqq-XEw,13595
9
+ datalex_core/docs_generator.py,sha256=bM69rUDVxJd6SnOiq1t2WutOHBWBQ88I7q6VH3AIlew,35261
10
+ datalex_core/doctor.py,sha256=WGlTXiIgrf7QT2fCi8V0EImAf4dBiUntqWRm1pGFvho,6625
11
+ datalex_core/generators.py,sha256=EJmPu3Iq4j5pkzmfda1vVF03IGFYaLm7kcbqAOfMobo,18227
12
+ datalex_core/importers.py,sha256=-KqDhMALeYuxH6nw9QnZqNjtXbwuTY3VfuTMKrESZJE,45548
13
+ datalex_core/issues.py,sha256=TB6O7vb3U93g8O8J46k53eYDERyykCdKO8UOm3uVvbY,513
14
+ datalex_core/loader.py,sha256=EXYAyL5WXo0LrmRHSJc9BlMXxd11Kc-E2z17QEotiVI,511
15
+ datalex_core/migrate.py,sha256=zWj9ULWi4G_e6yXzj9IzBfJ8AhXNO5VlPlVlNnkmEgY,11504
16
+ datalex_core/modeling.py,sha256=KXpQpYG3RxFxz8hjkV4nif0EOIgD_riLGwLhWv1GKHo,30440
17
+ datalex_core/packages.py,sha256=pBquIQ5wDMLCcQyhhuZPRQeP4-rJQY_uQ1f3jPpb-JA,15395
18
+ datalex_core/policy.py,sha256=5JFLEGVr-oxyhrbf8lVXW7S9H7jfMchy92NgXb2yeDs,39353
19
+ datalex_core/resolver.py,sha256=9JB5pcRSGyFSlb0aQ3wUCH3veGMNf3lsf1P_1KzZgFA,16700
20
+ datalex_core/schema.py,sha256=5_PtKpy-RyRIx2FElhaUOj7kYsoW8WMgkbPh9R_vlhs,1617
21
+ datalex_core/semantic.py,sha256=ieJkBWMzRzwLkTvPzwXGjChPlh34T8P4vUIGOS_Nilc,67109
22
+ datalex_core/_schemas/datalex/common.schema.json,sha256=neC1dYqtFSW_ZzeZDQfzbTUDOVnIm5xLAvND-sRiaeU,4630
23
+ datalex_core/_schemas/datalex/domain.schema.json,sha256=V4gAumfkJ1b8GFnPBuCMmcGeeE1TbhfSLmdLdCJ346s,796
24
+ datalex_core/_schemas/datalex/entity.schema.json,sha256=zg2-iebC7C61mLQ1iXJhUyGUo9oT0KrQSko8RwH8Oco,5566
25
+ datalex_core/_schemas/datalex/model.schema.json,sha256=aWMKplIamn9bScnrWhp_m1HER91xzGhOjLNwmmvxM_o,4692
26
+ datalex_core/_schemas/datalex/policy.schema.json,sha256=Q_3GvKaagLoM0dfmz5GLcDI7Of0_6SjDQL-Vy-FajdE,2156
27
+ datalex_core/_schemas/datalex/project.schema.json,sha256=p1k56c44rbcnW9A4Envj8-uRiI78LaZy_oejhct_P7E,2971
28
+ datalex_core/_schemas/datalex/snippet.schema.json,sha256=49fdpbJrTqE8iKNhuX83YDzQCr46IGZBLMMFdRGc0Tg,943
29
+ datalex_core/_schemas/datalex/source.schema.json,sha256=HNG5M6PON8IJ9k8dVbk4LOLLD0Iiwvmo4JP_Nd0nxUo,3467
30
+ datalex_core/_schemas/datalex/term.schema.json,sha256=3Fl4jQm1qt0jlwziMlqpRb_8oQj_PQFR3Met8BenxNs,1036
31
+ datalex_core/connectors/__init__.py,sha256=703nvPpu7qvGSIqEiawPVXU601fsYmd9mazVmgqMt3E,1232
32
+ datalex_core/connectors/base.py,sha256=hMcVw4JhEeqWJqkXz2NcHMZ9jhkCDDS3FSX_fILSjys,13845
33
+ datalex_core/connectors/bigquery.py,sha256=CNLQHphq2-KpuExQLlrx4zSQc9hF9XVZoqnVxKkKaiE,9051
34
+ datalex_core/connectors/databricks.py,sha256=iXEG6zwt3X2d1RUKhUVCSng9rSylOyKdwcFDVZ97G90,10812
35
+ datalex_core/connectors/mysql.py,sha256=qu61bsBxYm_MuhtJbUMRSUphD1_fHZNqrPheC8k1eVA,9683
36
+ datalex_core/connectors/postgres.py,sha256=TM3Mz-SKHrMXs3OYeeQc-syDZhZU22TR4VLs3vobNQQ,11717
37
+ datalex_core/connectors/redshift.py,sha256=SDGkWZK5SWIQ2_eqSvI4r7FUSg4S-uEcSPE8zJrBMGY,10896
38
+ datalex_core/connectors/snowflake.py,sha256=fNCzGvq7zpqK5ERHuB1RUGnwlnRrAFLHpGu-9LAR71A,13289
39
+ datalex_core/connectors/sqlserver.py,sha256=8lvX_KyvniLnnvF3-CKDQ7-1BvdS1WDLQP63cwa4eVw,15129
40
+ datalex_core/datalex/__init__.py,sha256=8pdvFW6nJhY-Y3zrddEeau6bS0cMfbFG8ttxrvUY-uQ,897
41
+ datalex_core/datalex/diff.py,sha256=xmP0lqYq1jrnwzJSndP4CKzadnEljWktFe0WgTc9aGI,7378
42
+ datalex_core/datalex/errors.py,sha256=v7JkGfoPFIP9uBICJr0-stU5SdS3pZceu02FIv4nB0s,2681
43
+ datalex_core/datalex/loader.py,sha256=CEFVjjnZePiFblgKI-9my4ywLXXuvs6oIX-cLA8e3D4,18740
44
+ datalex_core/datalex/migrate_layout.py,sha256=kmcT_DGnLqCQV79C75EkmxvMJovCuj00DT6t-UK-F98,14079
45
+ datalex_core/datalex/parse_cache.py,sha256=XeIqaN9FThPD4bKzowfCJyn1kX2Ek82Yi3HdGKiTYQ0,3667
46
+ datalex_core/datalex/project.py,sha256=fR5H8kaZDKFjeUesAQv7f9Jubvn1id1O0ILYdNuwISc,9164
47
+ datalex_core/datalex/types.py,sha256=uf9gryUUzPU91T1RUHNAFdtD1Q3dKI7jvn_InM0GHHk,7375
48
+ datalex_core/dbt/__init__.py,sha256=jrmcaq3k7LtjPtPJcHqiB_qgZlji-gwbAIPXEuQ5uvs,592
49
+ datalex_core/dbt/emit.py,sha256=iFtgWTCPTvHXb9Arie1-VSaHIGGmSUxtX7hvBAjMSac,11490
50
+ datalex_core/dbt/manifest.py,sha256=x1PfYFya4DtiPws9xwo3pBBN4L7m3Bpf1mfwiSMBuZo,11363
51
+ datalex_core/dbt/profiles.py,sha256=5CacRX8lohl3ay35g32glrwoWqW9Atk6KUSYL7KQ9j0,6097
52
+ datalex_core/dbt/sync.py,sha256=AIqsi_pIQcPLXSfCmEqoIAwYaXjYBymQYfCeIv_jBys,9416
53
+ datalex_core/dbt/warehouse.py,sha256=5j9SatDOBp-gKr2q2ltWzKugVQ_TLfzZ-5NXq2uPxWg,6350
54
+ datalex_core/dialects/__init__.py,sha256=ierJOZ0q13Q8wBuB04IR0dUEjJL2iJPorKdZFMWv2AA,623
55
+ datalex_core/dialects/_common.py,sha256=klZ3XPOCPJtjcRfXOEZCfYkvtxLJspeWBCHh-oEkqRk,1510
56
+ datalex_core/dialects/base.py,sha256=r2AXVmulk3XZxZY9v0TzB7owIdukfHgD6IMDLylZ62E,1673
57
+ datalex_core/dialects/postgres.py,sha256=Zj3PoAvMY7V9AQt-Ea6EuU-mcGMXxig2XyweeAZh7oE,5836
58
+ datalex_core/dialects/registry.py,sha256=143fLrdgu7we_hRfbELJopEp_Pz5gF1xfgN7XPtk4a8,916
59
+ datalex_core/dialects/snowflake.py,sha256=P0aQA_W0HnOcvbadPvAWMOlExIo0M283KkIZKmaj2tU,4300
60
+ datalex_cli-0.1.1.dist-info/METADATA,sha256=2FFHrsXgQLDK_3BYgUXpHhy-emgYG8ulsi-r6OstH_A,8806
61
+ datalex_cli-0.1.1.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
62
+ datalex_cli-0.1.1.dist-info/entry_points.txt,sha256=ZmyuOFbananx8g9s9EFJgjbos_QIivlOiJSBexkpB8E,50
63
+ datalex_cli-0.1.1.dist-info/top_level.txt,sha256=_QSh6m7EKJoUOs-6rpwUgNXwrbv0l5gMq_fF2skrtZw,25
64
+ datalex_cli-0.1.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ datalex = datalex_cli.main:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 duckcode.ai
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,2 @@
1
+ datalex_cli
2
+ datalex_core
@@ -0,0 +1,94 @@
1
+ from datalex_core.canonical import compile_model
2
+ from datalex_core.diffing import project_diff, semantic_diff
3
+ from datalex_core.docs_generator import (
4
+ generate_changelog,
5
+ generate_html_docs,
6
+ generate_markdown_docs,
7
+ write_changelog,
8
+ write_html_docs,
9
+ write_markdown_docs,
10
+ )
11
+ from datalex_core.completion import generate_bash_completion, generate_fish_completion, generate_zsh_completion
12
+ from datalex_core.doctor import diagnostics_as_json, format_diagnostics, run_diagnostics
13
+ from datalex_core.generators import dbt_scaffold_files, generate_sql_ddl, write_dbt_scaffold
14
+ from datalex_core.migrate import generate_migration, write_migration
15
+ from datalex_core.modeling import (
16
+ apply_standards_fixes,
17
+ merge_models_preserving_docs,
18
+ normalize_model,
19
+ standards_issues,
20
+ transform_model,
21
+ )
22
+ from datalex_core.importers import (
23
+ import_dbt_schema_yml,
24
+ import_dbml,
25
+ import_spark_schema,
26
+ import_sql_ddl,
27
+ sync_dbt_schema_yml,
28
+ )
29
+ from datalex_core.connectors.base import ConnectorConfig, ConnectorResult, get_connector, list_connectors
30
+ from datalex_core.loader import load_yaml_model
31
+ from datalex_core.policy import (
32
+ load_policy_pack,
33
+ load_policy_pack_with_inheritance,
34
+ merge_policy_packs,
35
+ policy_issues,
36
+ )
37
+ from datalex_core.resolver import resolve_model, resolve_project
38
+ from datalex_core.schema import load_schema, schema_issues
39
+ from datalex_core.semantic import (
40
+ completeness_as_dict,
41
+ completeness_report,
42
+ lint_issues,
43
+ EntityCompleteness,
44
+ ModelCompleteness,
45
+ )
46
+
47
+ __all__ = [
48
+ "compile_model",
49
+ "completeness_as_dict",
50
+ "completeness_report",
51
+ "ConnectorConfig",
52
+ "ConnectorResult",
53
+ "dbt_scaffold_files",
54
+ "diagnostics_as_json",
55
+ "EntityCompleteness",
56
+ "format_diagnostics",
57
+ "generate_bash_completion",
58
+ "generate_fish_completion",
59
+ "generate_migration",
60
+ "generate_changelog",
61
+ "generate_html_docs",
62
+ "generate_markdown_docs",
63
+ "generate_sql_ddl",
64
+ "generate_zsh_completion",
65
+ "import_dbml",
66
+ "import_dbt_schema_yml",
67
+ "import_spark_schema",
68
+ "import_sql_ddl",
69
+ "lint_issues",
70
+ "load_policy_pack",
71
+ "load_policy_pack_with_inheritance",
72
+ "merge_policy_packs",
73
+ "merge_models_preserving_docs",
74
+ "load_schema",
75
+ "load_yaml_model",
76
+ "ModelCompleteness",
77
+ "normalize_model",
78
+ "policy_issues",
79
+ "project_diff",
80
+ "resolve_model",
81
+ "resolve_project",
82
+ "apply_standards_fixes",
83
+ "schema_issues",
84
+ "semantic_diff",
85
+ "standards_issues",
86
+ "transform_model",
87
+ "run_diagnostics",
88
+ "write_changelog",
89
+ "write_dbt_scaffold",
90
+ "write_migration",
91
+ "write_html_docs",
92
+ "write_markdown_docs",
93
+ "sync_dbt_schema_yml",
94
+ ]
@@ -0,0 +1,127 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://duckcode.dev/schemas/datalex/common.schema.json",
4
+ "title": "DataLex common definitions",
5
+ "$defs": {
6
+ "snake_name": {
7
+ "type": "string",
8
+ "pattern": "^[a-z][a-z0-9_]*$"
9
+ },
10
+ "kebab_tag": {
11
+ "type": "string",
12
+ "pattern": "^[a-z][a-z0-9-]*$"
13
+ },
14
+ "meta": {
15
+ "type": "object",
16
+ "description": "User-owned metadata. DataLex generators MUST NOT write outside the meta.datalex.* subtree.",
17
+ "additionalProperties": true
18
+ },
19
+ "tags": {
20
+ "type": "array",
21
+ "items": { "$ref": "#/$defs/kebab_tag" }
22
+ },
23
+ "owner": {
24
+ "type": "string",
25
+ "minLength": 1
26
+ },
27
+ "description": {
28
+ "type": "string"
29
+ },
30
+ "previous_name": {
31
+ "description": "Explicit rename tracking. If present, diff treats (previous_name -> name) as a rename, not drop+add.",
32
+ "$ref": "#/$defs/snake_name"
33
+ },
34
+ "logical_type": {
35
+ "type": "string",
36
+ "description": "Logical type: primitive (string, integer, bigint, decimal(p,s), float, boolean, date, timestamp, timestamp_tz, interval, uuid, json, binary, text) or composite (array<T>, map<K,V>, struct<a:T,b:U>).",
37
+ "minLength": 1
38
+ },
39
+ "physical_override": {
40
+ "type": "object",
41
+ "description": "Per-dialect physical type override for a column.",
42
+ "additionalProperties": {
43
+ "type": "object",
44
+ "additionalProperties": false,
45
+ "properties": {
46
+ "type": { "type": "string" },
47
+ "raw_ddl": { "type": "string" }
48
+ }
49
+ }
50
+ },
51
+ "constraint": {
52
+ "type": "object",
53
+ "required": ["type"],
54
+ "additionalProperties": true,
55
+ "properties": {
56
+ "type": {
57
+ "type": "string",
58
+ "enum": ["check", "not_null", "unique", "primary_key", "foreign_key"]
59
+ },
60
+ "expression": { "type": "string" }
61
+ }
62
+ },
63
+ "reference": {
64
+ "type": "object",
65
+ "required": ["entity", "column"],
66
+ "additionalProperties": false,
67
+ "properties": {
68
+ "entity": { "$ref": "#/$defs/snake_name" },
69
+ "column": { "$ref": "#/$defs/snake_name" },
70
+ "on_delete": { "type": "string", "enum": ["restrict", "cascade", "set_null", "no_action"] },
71
+ "on_update": { "type": "string", "enum": ["restrict", "cascade", "set_null", "no_action"] },
72
+ "relationship": { "type": "string", "enum": ["many_to_one", "one_to_one", "many_to_many"] }
73
+ }
74
+ },
75
+ "column": {
76
+ "type": "object",
77
+ "required": ["name", "type"],
78
+ "additionalProperties": false,
79
+ "properties": {
80
+ "name": { "$ref": "#/$defs/snake_name" },
81
+ "previous_name": { "$ref": "#/$defs/previous_name" },
82
+ "type": { "$ref": "#/$defs/logical_type" },
83
+ "physical": { "$ref": "#/$defs/physical_override" },
84
+ "logical": {
85
+ "type": "string",
86
+ "description": "Back-reference to the logical column this physical column implements, e.g. 'order.id'."
87
+ },
88
+ "description": { "$ref": "#/$defs/description" },
89
+ "nullable": { "type": "boolean", "default": true },
90
+ "primary_key": { "type": "boolean", "default": false },
91
+ "unique": { "type": "boolean", "default": false },
92
+ "default": { "type": ["string", "number", "boolean", "null"] },
93
+ "references": { "$ref": "#/$defs/reference" },
94
+ "constraints": {
95
+ "type": "array",
96
+ "items": { "$ref": "#/$defs/constraint" }
97
+ },
98
+ "sensitivity": {
99
+ "type": "string",
100
+ "description": "Sensitivity tag. Must be defined in .datalex/sensitivity.yaml (free-form; validator checks membership if the file exists)."
101
+ },
102
+ "terms": {
103
+ "type": "array",
104
+ "items": {
105
+ "type": "string",
106
+ "pattern": "^(term:)?[a-z][a-z0-9_]*$"
107
+ }
108
+ },
109
+ "tags": { "$ref": "#/$defs/tags" },
110
+ "use": {
111
+ "description": "Name of a snippet under .datalex/snippets/ to merge into this column (merge semantics: snippet fields fill in missing keys; column keys win on conflict).",
112
+ "$ref": "#/$defs/snake_name"
113
+ },
114
+ "examples": {
115
+ "type": "array",
116
+ "items": { "type": ["string", "number", "boolean", "null"] }
117
+ },
118
+ "deprecated": { "type": "boolean" },
119
+ "meta": { "$ref": "#/$defs/meta" }
120
+ }
121
+ },
122
+ "raw_ddl": {
123
+ "type": "string",
124
+ "description": "Original DDL preserved from reverse engineering when a feature couldn't be mapped cleanly. Forward engineering replays this verbatim."
125
+ }
126
+ }
127
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://duckcode.dev/schemas/datalex/domain.schema.json",
4
+ "title": "DataLex domain (subject-area grouping)",
5
+ "type": "object",
6
+ "required": ["kind", "name"],
7
+ "additionalProperties": false,
8
+ "properties": {
9
+ "kind": { "const": "domain" },
10
+ "name": { "type": "string", "pattern": "^[a-z][a-z0-9_]*$" },
11
+ "description": { "type": "string" },
12
+ "owner": { "type": "string" },
13
+ "color": { "type": "string" },
14
+ "entities": {
15
+ "type": "array",
16
+ "items": { "type": "string", "pattern": "^[a-z][a-z0-9_]*$" }
17
+ },
18
+ "tags": {
19
+ "type": "array",
20
+ "items": { "type": "string", "pattern": "^[a-z][a-z0-9-]*$" }
21
+ },
22
+ "meta": { "type": "object", "additionalProperties": true }
23
+ }
24
+ }