quickdbd-cli 0.1.10__tar.gz → 0.1.11__tar.gz

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 (71) hide show
  1. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/NOTICE +13 -0
  2. quickdbd_cli-0.1.11/PKG-INFO +249 -0
  3. quickdbd_cli-0.1.11/README.md +221 -0
  4. quickdbd_cli-0.1.11/gallery/adventureworks/LICENSE +25 -0
  5. quickdbd_cli-0.1.11/gallery/chinook/LICENSE +11 -0
  6. quickdbd_cli-0.1.11/gallery/northwind/LICENSE +25 -0
  7. quickdbd_cli-0.1.11/gallery/sakila/LICENSE +29 -0
  8. quickdbd_cli-0.1.11/gallery/shopify/LICENSE +201 -0
  9. quickdbd_cli-0.1.11/gallery/shopify/README.md +10 -0
  10. quickdbd_cli-0.1.11/gallery/synthea/LICENSE +201 -0
  11. quickdbd_cli-0.1.11/gallery/synthea/README.md +7 -0
  12. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/pyproject.toml +1 -1
  13. quickdbd_cli-0.1.11/scripts/build_gallery.py +265 -0
  14. quickdbd_cli-0.1.11/scripts/gen_thumbnails.py +106 -0
  15. quickdbd_cli-0.1.11/src/quickdbd_cli/__init__.py +1 -0
  16. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/src/quickdbd_cli/dbt.py +1 -0
  17. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/tests/test_dbt.py +14 -0
  18. quickdbd_cli-0.1.11/tests/test_gallery.py +107 -0
  19. quickdbd_cli-0.1.10/PKG-INFO +0 -485
  20. quickdbd_cli-0.1.10/README.md +0 -457
  21. quickdbd_cli-0.1.10/src/quickdbd_cli/__init__.py +0 -1
  22. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/.gitignore +0 -0
  23. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/LICENSE +0 -0
  24. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/examples/quickdbd-sample.txt +0 -0
  25. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/examples/synthetic/finance.txt +0 -0
  26. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/examples/synthetic/hr.txt +0 -0
  27. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/examples/synthetic/inventory.txt +0 -0
  28. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/examples/synthetic/marketing.txt +0 -0
  29. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/examples/synthetic/qdbd.layout.json +0 -0
  30. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/examples/synthetic/sales.txt +0 -0
  31. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/scripts/gen_font_metrics.py +0 -0
  32. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/scripts/gen_schema.py +0 -0
  33. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/scripts/release.sh +0 -0
  34. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/src/quickdbd_cli/__main__.py +0 -0
  35. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/src/quickdbd_cli/assets/Inter-Bold.ttf +0 -0
  36. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/src/quickdbd_cli/assets/Inter-Bold.woff2 +0 -0
  37. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/src/quickdbd_cli/assets/Inter-LICENSE.txt +0 -0
  38. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/src/quickdbd_cli/assets/Inter-Regular.ttf +0 -0
  39. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/src/quickdbd_cli/assets/Inter-Regular.woff2 +0 -0
  40. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/src/quickdbd_cli/assets/editor.js +0 -0
  41. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/src/quickdbd_cli/assets/elk-LICENSE.md +0 -0
  42. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/src/quickdbd_cli/assets/elk.bundled.js +0 -0
  43. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/src/quickdbd_cli/assets/font-metrics.json +0 -0
  44. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/src/quickdbd_cli/assets/render.js +0 -0
  45. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/src/quickdbd_cli/assets/style.css +0 -0
  46. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/src/quickdbd_cli/assets/viewer.js +0 -0
  47. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/src/quickdbd_cli/cli.py +0 -0
  48. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/src/quickdbd_cli/diff.py +0 -0
  49. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/src/quickdbd_cli/export.py +0 -0
  50. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/src/quickdbd_cli/html.py +0 -0
  51. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/src/quickdbd_cli/jsrt.py +0 -0
  52. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/src/quickdbd_cli/layout.py +0 -0
  53. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/src/quickdbd_cli/measure.py +0 -0
  54. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/src/quickdbd_cli/model.py +0 -0
  55. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/src/quickdbd_cli/parser.py +0 -0
  56. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/src/quickdbd_cli/project.py +0 -0
  57. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/src/quickdbd_cli/serve.py +0 -0
  58. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/src/quickdbd_cli/share.py +0 -0
  59. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/src/quickdbd_cli/tags.py +0 -0
  60. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/tests/fixtures/jaffle/LICENSE +0 -0
  61. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/tests/fixtures/jaffle/README.md +0 -0
  62. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/tests/fixtures/jaffle/catalog.json +0 -0
  63. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/tests/fixtures/jaffle/manifest.json +0 -0
  64. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/tests/test_diff.py +0 -0
  65. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/tests/test_parser.py +0 -0
  66. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/tests/test_path.py +0 -0
  67. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/tests/test_pipeline.py +0 -0
  68. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/tests/test_select.py +0 -0
  69. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/tests/test_serve.py +0 -0
  70. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/tests/test_share.py +0 -0
  71. {quickdbd_cli-0.1.10 → quickdbd_cli-0.1.11}/tests/test_tags.py +0 -0
@@ -14,6 +14,19 @@ This product bundles third-party components, distributed unmodified:
14
14
  Copyright The Inter Project Authors. Licensed under the SIL Open Font License 1.1
15
15
  (src/quickdbd_cli/assets/Inter-LICENSE.txt). Source: https://github.com/rsms/inter
16
16
 
17
+ The demo gallery (gallery/, not part of the Python package) includes schemas derived from:
18
+
19
+ * Northwind and AdventureWorks (gallery/northwind, gallery/adventureworks), converted from
20
+ microsoft/sql-server-samples. Copyright (c) Microsoft Corporation. MIT License.
21
+ * Sakila (gallery/sakila), converted from sakila-schema.sql. Copyright (c) 2006, 2026, Oracle and/or
22
+ its affiliates. BSD-3-Clause.
23
+ * Chinook (gallery/chinook), converted from lerocha/chinook-database. Copyright (c) 2008-2024
24
+ Luis Rocha. MIT License.
25
+ * dbt-synthea (gallery/synthea), OHDSI. Apache License 2.0. Trimmed dbt manifest and catalog only.
26
+ * dbt_shopify (gallery/shopify), Fivetran. Apache License 2.0. Trimmed dbt manifest and catalog only.
27
+
28
+ Each folder keeps the upstream licence in its LICENSE file.
29
+
17
30
  `qdbd serve` loads CodeMirror 5 (MIT) from cdnjs at runtime; it is not bundled.
18
31
 
19
32
  QuickDBD is a product of its respective owners; this project is not affiliated with it.
@@ -0,0 +1,249 @@
1
+ Metadata-Version: 2.5
2
+ Name: quickdbd-cli
3
+ Version: 0.1.11
4
+ Summary: Compile QuickDBD-syntax schema files into interactive HTML ER diagrams, with no table limit.
5
+ Project-URL: Homepage, https://github.com/MarkPhamm/quickdbd-cli
6
+ Author: Minh (Mark) Pham
7
+ License-Expression: Apache-2.0
8
+ License-File: LICENSE
9
+ License-File: NOTICE
10
+ License-File: src/quickdbd_cli/assets/Inter-LICENSE.txt
11
+ License-File: src/quickdbd_cli/assets/elk-LICENSE.md
12
+ Keywords: database,diagram,erd,quickdbd,schema
13
+ Classifier: Environment :: Console
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Topic :: Database
16
+ Classifier: Topic :: Software Development :: Documentation
17
+ Requires-Python: >=3.11
18
+ Requires-Dist: mini-racer>=0.14
19
+ Requires-Dist: resvg-py>=0.5
20
+ Provides-Extra: dev
21
+ Requires-Dist: fonttools>=4.50; extra == 'dev'
22
+ Requires-Dist: pytest>=8; extra == 'dev'
23
+ Requires-Dist: ruff>=0.6; extra == 'dev'
24
+ Provides-Extra: docs
25
+ Requires-Dist: mkdocs-material<10,>=9.5; extra == 'docs'
26
+ Requires-Dist: mkdocs<2,>=1.6; extra == 'docs'
27
+ Description-Content-Type: text/markdown
28
+
29
+ <p align="center">
30
+ <picture>
31
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/MarkPhamm/quickdbd-cli/main/docs/assets/img/logo-wordmark-dark.svg">
32
+ <img src="https://raw.githubusercontent.com/MarkPhamm/quickdbd-cli/main/docs/assets/img/logo-wordmark-light.svg" alt="qdbd" width="220">
33
+ </picture>
34
+ </p>
35
+
36
+ <p align="center"><b>Interactive ER diagrams from QuickDBD text or a dbt project, readable at 200+ tables</b></p>
37
+
38
+ <p align="center">
39
+ <a href="https://markphamm.github.io/quickdbd-cli/">Docs</a> · <a href="https://markphamm.github.io/quickdbd-cli/demo/">Live demos</a> · <a href="#quickstart">Quickstart</a> · <a href="https://pypi.org/project/quickdbd-cli/">PyPI</a>
40
+ </p>
41
+
42
+ <p align="center">
43
+ <a href="https://markphamm.github.io/quickdbd-cli/demo/adventureworks/#t=SalesOrderHeader"><img src="https://raw.githubusercontent.com/MarkPhamm/quickdbd-cli/main/docs/assets/img/hero.png" alt="The AdventureWorks sample database as a qdbd diagram, with the SalesOrderHeader table selected" width="760"></a>
44
+ </p>
45
+ <p align="center">
46
+ <em>AdventureWorks (68 tables) with its column descriptions, built by qdbd. <a href="https://markphamm.github.io/quickdbd-cli/demo/adventureworks/#t=SalesOrderHeader">Try it live →</a></em>
47
+ </p>
48
+
49
+ ## What is qdbd?
50
+
51
+ qdbd is a **command-line tool that turns a database schema written as text into an interactive ER diagram**.
52
+
53
+ - Diagrams drawn by hand look good, but they live outside the repo and go stale the first time the schema changes.
54
+ - Generated diagrams stay current, but most become unreadable past a few dozen tables.
55
+
56
+ With qdbd the schema is a plain-text file in git, written in [QuickDBD](https://www.quickdatabasediagrams.com)'s syntax or generated from a dbt project. qdbd checks it, lays it out, and builds **one self-contained HTML page** you can search, filter, click through and share.
57
+
58
+ You get **a diagram that lives next to your code** and **stays usable at hundreds of tables**.
59
+
60
+ qdbd is not affiliated with QuickDBD. It reads the same text syntax, so schemas copy back and forth between the two.
61
+
62
+ ## Key features
63
+
64
+ - **QuickDBD-compatible**: the parser mirrors QuickDBD's own, error messages included. A file that passes `qdbd check --strict` pastes into QuickDBD unchanged.
65
+ - **dbt import**: `qdbd import dbt` reads `manifest.json`. Primary keys come from `unique` + `not_null` tests or constraints, relationships from `relationships` tests, and `--infer-fks` fills the gaps from column names.
66
+ - **Readable at 200+ tables**: automatic layout, search, dbt-style selectors (`+orders+1`, `group:marts`, `tag:fact`), shaded regions per file, collapsed views and a minimap.
67
+ - **Review changes in pull requests**: `qdbd diff` reports what a branch changed, the GitHub Action posts it as a PR comment, and `--diff-base` colours the changes in the diagram.
68
+ - **One schema, many outputs**: an HTML page, PNG, SVG, editable draw.io, or a shareable link. Installs with pip: no Node, Graphviz or browser needed.
69
+
70
+ ## Demo gallery
71
+
72
+ Every demo is a single HTML page written by `qdbd build`, from a QuickDBD schema or a dbt manifest.
73
+
74
+ <!-- gallery:start: generated by `python scripts/build_gallery.py --readme` from gallery/demos.toml -->
75
+ | | |
76
+ |---|---|
77
+ | [![200 tables](https://raw.githubusercontent.com/MarkPhamm/quickdbd-cli/main/docs/assets/img/gallery/synthetic.png)](https://markphamm.github.io/quickdbd-cli/demo/synthetic/)<br>**[200 tables](https://markphamm.github.io/quickdbd-cli/demo/synthetic/)**<br>Five business domains, 200 tables and every relationship type. Search, filter, click a table to focus it. | [![Schema diff](https://raw.githubusercontent.com/MarkPhamm/quickdbd-cli/main/docs/assets/img/gallery/diff.png)](https://markphamm.github.io/quickdbd-cli/demo/diff/)<br>**[Schema diff](https://markphamm.github.io/quickdbd-cli/demo/diff/)**<br>What a branch changed, coloured in: new tables in green, changed columns in amber, removals listed. |
78
+ | [![AdventureWorks](https://raw.githubusercontent.com/MarkPhamm/quickdbd-cli/main/docs/assets/img/gallery/adventureworks.png)](https://markphamm.github.io/quickdbd-cli/demo/adventureworks/)<br>**[AdventureWorks](https://markphamm.github.io/quickdbd-cli/demo/adventureworks/)**<br>Microsoft's bicycle-company OLTP database: 68 tables in five schemas, one region each, with column descriptions. | [![OMOP CDM on Synthea](https://raw.githubusercontent.com/MarkPhamm/quickdbd-cli/main/docs/assets/img/gallery/synthea.png)](https://markphamm.github.io/quickdbd-cli/demo/synthea/#t=concept)<br>**[OMOP CDM on Synthea](https://markphamm.github.io/quickdbd-cli/demo/synthea/#t=concept)**<br>OHDSI's dbt-synthea: synthetic patient records mapped to the OMOP Common Data Model. 145 tables, 235 relationships from tests. |
79
+
80
+ [View all 14 demos →](https://markphamm.github.io/quickdbd-cli/demo/)
81
+ <!-- gallery:end -->
82
+
83
+ ## Quickstart
84
+
85
+ ### Fastest start: try it without installing
86
+
87
+ ```sh
88
+ curl -O https://raw.githubusercontent.com/MarkPhamm/quickdbd-cli/main/examples/quickdbd-sample.txt
89
+ uvx --from quickdbd-cli qdbd serve quickdbd-sample.txt
90
+ ```
91
+
92
+ A browser tab opens with the diagram and an editor. Change the text and the diagram reloads; drag tables to arrange them.
93
+
94
+ ### Or step by step
95
+
96
+ #### 1. Install
97
+
98
+ ```sh
99
+ pipx install quickdbd-cli # or: pip install quickdbd-cli / uv tool install quickdbd-cli
100
+ ```
101
+
102
+ Python 3.11+. See [Install](https://markphamm.github.io/quickdbd-cli/install/) for other options.
103
+
104
+ #### 2. Write a schema, or generate one from dbt
105
+
106
+ Save this as `schema.txt`, or paste in a schema from QuickDBD unchanged:
107
+
108
+ ```text
109
+ Customer
110
+ -
111
+ CustomerId PK int
112
+ Email string UNIQUE
113
+
114
+ Order as o
115
+ ----
116
+ OrderId PK int
117
+ CustomerId int FK >- Customer.CustomerId
118
+ Total decimal(10,2)
119
+ ```
120
+
121
+ A table is a name, a line of dashes, then one column per line. `FK >- Customer.CustomerId` means many orders to one customer. The full syntax is in [Schema Syntax](https://markphamm.github.io/quickdbd-cli/syntax/).
122
+
123
+ For a dbt project, generate the schema instead:
124
+
125
+ ```sh
126
+ dbt docs generate # writes target/manifest.json + catalog.json
127
+ qdbd import dbt target/ -o erd/ --infer-fks # one .txt file per dbt folder
128
+ ```
129
+
130
+ #### 3. Edit it live
131
+
132
+ ```sh
133
+ qdbd serve schema.txt
134
+ ```
135
+
136
+ Edit in the browser or in your own editor; the diagram reloads on save. Dragged positions are saved to `schema.layout.json`, which you commit next to the schema.
137
+
138
+ #### 4. Build, export and share
139
+
140
+ ```sh
141
+ qdbd build schema.txt -o schema.html # one self-contained page
142
+ qdbd export schema.txt -o schema.png # or .svg, .drawio
143
+ qdbd share schema.txt # a link to the page, via a GitHub gist
144
+ ```
145
+
146
+ ## Run in CI
147
+
148
+ The GitHub Action checks the schema and builds the diagram. On pull requests it also posts one schema-diff comment, updated on every push.
149
+
150
+ ```yaml
151
+ # .github/workflows/erd.yml
152
+ name: ERD
153
+ on: [pull_request, push]
154
+ jobs:
155
+ erd:
156
+ runs-on: ubuntu-latest
157
+ permissions: { contents: read, pull-requests: write }
158
+ steps:
159
+ - uses: actions/checkout@v4
160
+ - uses: MarkPhamm/quickdbd-cli@v0.1.11
161
+ with:
162
+ path: erd/ # schema file(s) or folder(s)
163
+ output: site/index.html
164
+ ```
165
+
166
+ dbt projects, GitHub Pages, pre-commit and GitLab CI are covered in [CI and Automation](https://markphamm.github.io/quickdbd-cli/github-action/).
167
+
168
+ ## How qdbd works
169
+
170
+ ```text
171
+ dbt project ──qdbd import dbt──┐
172
+ ├──▶ schema/*.txt (QuickDBD syntax, in git)
173
+ hand-written / pasted ─────────┘ │
174
+ ├──▶ qdbd check validation, QuickDBD's error messages ──▶ CI gate
175
+ ├──▶ qdbd serve live editor, drag to arrange ──▶ schema.layout.json
176
+ ├──▶ qdbd build interactive HTML ──▶ GitHub Pages, artifacts
177
+ ├──▶ qdbd diff what changed vs main ──▶ PR comment
178
+ └──▶ qdbd export PNG · SVG · draw.io ──▶ docs, slides, wikis
179
+ ```
180
+
181
+ - **The parser** follows QuickDBD's own parser step by step, so the same text gives the same tables and the same errors.
182
+ - **The layout** comes from [ELK](https://eclipse.dev/elk/). Positions you drag are saved by table name, and new tables are placed next to the tables they relate to, so the diagram doesn't reshuffle.
183
+ - **One renderer** draws both the page and the images. It runs in the browser, and inside an embedded JavaScript engine for CLI exports, so a PNG always matches the page.
184
+ - **Builds are deterministic**: no timestamps or randomness, so the output only changes when the schema does.
185
+
186
+ ## What it looks like
187
+
188
+ **1. The schema**, a text file in your repo:
189
+
190
+ ```text
191
+ # Every order belongs to one customer.
192
+ Order as o
193
+ ----
194
+ OrderId PK int IDENTITY
195
+ CustomerId int FK >- Customer.CustomerId
196
+ Status string="pending" # current fulfilment state
197
+ ```
198
+
199
+ **2. The command:**
200
+
201
+ ```sh
202
+ qdbd build schema/ -o erd.html
203
+ ```
204
+
205
+ **3. The page:** click a table for its columns, comments and relationships, or type another table's name to get the join path as SQL.
206
+
207
+ ![Table details panel](https://raw.githubusercontent.com/MarkPhamm/quickdbd-cli/main/docs/assets/img/details.png)
208
+
209
+ ## qdbd and QuickDBD
210
+
211
+ | | qdbd | QuickDBD |
212
+ |---|---|---|
213
+ | Text syntax | QuickDBD's | QuickDBD's |
214
+ | Tables per diagram | no limit | 10 on the free plan |
215
+ | Where it runs | your terminal and CI; the result is a static HTML file | the QuickDBD web app |
216
+ | Where the schema lives | `.txt` files in your git repo | the web app |
217
+ | dbt import, schema diffs, PR comments | ✅ | — |
218
+
219
+ Use QuickDBD's editor when you want it: a schema that passes `qdbd check --strict` pastes in unchanged.
220
+
221
+ ## FAQ
222
+
223
+ **Do I need a QuickDBD account?**
224
+ No. qdbd only borrows the text syntax.
225
+
226
+ **Does qdbd connect to my database?**
227
+ No. It reads `.txt` schema files or a dbt `manifest.json`. Nothing connects to a warehouse.
228
+
229
+ **Does my schema leave my machine?**
230
+ Only if you run `qdbd share`, which uploads the page to a GitHub gist in your account (secret by default). `qdbd serve` loads its code editor from a CDN; the built pages load nothing.
231
+
232
+ **How big can a diagram get?**
233
+ The demos go up to 200 tables. Search, selectors, regions and collapsed views keep large diagrams workable; `--select` builds a page with just the part you need.
234
+
235
+ **Can I edit the diagram by hand?**
236
+ You edit the text; the diagram is generated from it. Table positions are the one thing you arrange yourself, by dragging in `qdbd serve`.
237
+
238
+ ## Learn more
239
+
240
+ - [Install](https://markphamm.github.io/quickdbd-cli/install/) and [Quick Start](https://markphamm.github.io/quickdbd-cli/getting-started/)
241
+ - [Schema Syntax](https://markphamm.github.io/quickdbd-cli/syntax/), [many files](https://markphamm.github.io/quickdbd-cli/files/), [table positions](https://markphamm.github.io/quickdbd-cli/layout/), [tags and colours](https://markphamm.github.io/quickdbd-cli/tags/)
242
+ - [Reading the Diagram](https://markphamm.github.io/quickdbd-cli/reading-the-diagram/), [selectors](https://markphamm.github.io/quickdbd-cli/selectors/), [exports](https://markphamm.github.io/quickdbd-cli/exports/), [sharing a link](https://markphamm.github.io/quickdbd-cli/sharing/)
243
+ - [dbt Projects](https://markphamm.github.io/quickdbd-cli/dbt/), with a [jaffle_shop walkthrough](https://markphamm.github.io/quickdbd-cli/example/)
244
+ - [Schema Diffs](https://markphamm.github.io/quickdbd-cli/diffs/), the [GitHub Action](https://markphamm.github.io/quickdbd-cli/github-action/) and the [CLI reference](https://markphamm.github.io/quickdbd-cli/cli/)
245
+ - [Development](https://markphamm.github.io/quickdbd-cli/development/): working on qdbd itself, releasing, and adding a demo
246
+
247
+ ## License
248
+
249
+ Apache-2.0. Bundled third-party files (ELK, Inter) and the sources of the demo schemas are listed in [NOTICE](https://github.com/MarkPhamm/quickdbd-cli/blob/main/NOTICE).
@@ -0,0 +1,221 @@
1
+ <p align="center">
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/MarkPhamm/quickdbd-cli/main/docs/assets/img/logo-wordmark-dark.svg">
4
+ <img src="https://raw.githubusercontent.com/MarkPhamm/quickdbd-cli/main/docs/assets/img/logo-wordmark-light.svg" alt="qdbd" width="220">
5
+ </picture>
6
+ </p>
7
+
8
+ <p align="center"><b>Interactive ER diagrams from QuickDBD text or a dbt project, readable at 200+ tables</b></p>
9
+
10
+ <p align="center">
11
+ <a href="https://markphamm.github.io/quickdbd-cli/">Docs</a> · <a href="https://markphamm.github.io/quickdbd-cli/demo/">Live demos</a> · <a href="#quickstart">Quickstart</a> · <a href="https://pypi.org/project/quickdbd-cli/">PyPI</a>
12
+ </p>
13
+
14
+ <p align="center">
15
+ <a href="https://markphamm.github.io/quickdbd-cli/demo/adventureworks/#t=SalesOrderHeader"><img src="https://raw.githubusercontent.com/MarkPhamm/quickdbd-cli/main/docs/assets/img/hero.png" alt="The AdventureWorks sample database as a qdbd diagram, with the SalesOrderHeader table selected" width="760"></a>
16
+ </p>
17
+ <p align="center">
18
+ <em>AdventureWorks (68 tables) with its column descriptions, built by qdbd. <a href="https://markphamm.github.io/quickdbd-cli/demo/adventureworks/#t=SalesOrderHeader">Try it live →</a></em>
19
+ </p>
20
+
21
+ ## What is qdbd?
22
+
23
+ qdbd is a **command-line tool that turns a database schema written as text into an interactive ER diagram**.
24
+
25
+ - Diagrams drawn by hand look good, but they live outside the repo and go stale the first time the schema changes.
26
+ - Generated diagrams stay current, but most become unreadable past a few dozen tables.
27
+
28
+ With qdbd the schema is a plain-text file in git, written in [QuickDBD](https://www.quickdatabasediagrams.com)'s syntax or generated from a dbt project. qdbd checks it, lays it out, and builds **one self-contained HTML page** you can search, filter, click through and share.
29
+
30
+ You get **a diagram that lives next to your code** and **stays usable at hundreds of tables**.
31
+
32
+ qdbd is not affiliated with QuickDBD. It reads the same text syntax, so schemas copy back and forth between the two.
33
+
34
+ ## Key features
35
+
36
+ - **QuickDBD-compatible**: the parser mirrors QuickDBD's own, error messages included. A file that passes `qdbd check --strict` pastes into QuickDBD unchanged.
37
+ - **dbt import**: `qdbd import dbt` reads `manifest.json`. Primary keys come from `unique` + `not_null` tests or constraints, relationships from `relationships` tests, and `--infer-fks` fills the gaps from column names.
38
+ - **Readable at 200+ tables**: automatic layout, search, dbt-style selectors (`+orders+1`, `group:marts`, `tag:fact`), shaded regions per file, collapsed views and a minimap.
39
+ - **Review changes in pull requests**: `qdbd diff` reports what a branch changed, the GitHub Action posts it as a PR comment, and `--diff-base` colours the changes in the diagram.
40
+ - **One schema, many outputs**: an HTML page, PNG, SVG, editable draw.io, or a shareable link. Installs with pip: no Node, Graphviz or browser needed.
41
+
42
+ ## Demo gallery
43
+
44
+ Every demo is a single HTML page written by `qdbd build`, from a QuickDBD schema or a dbt manifest.
45
+
46
+ <!-- gallery:start: generated by `python scripts/build_gallery.py --readme` from gallery/demos.toml -->
47
+ | | |
48
+ |---|---|
49
+ | [![200 tables](https://raw.githubusercontent.com/MarkPhamm/quickdbd-cli/main/docs/assets/img/gallery/synthetic.png)](https://markphamm.github.io/quickdbd-cli/demo/synthetic/)<br>**[200 tables](https://markphamm.github.io/quickdbd-cli/demo/synthetic/)**<br>Five business domains, 200 tables and every relationship type. Search, filter, click a table to focus it. | [![Schema diff](https://raw.githubusercontent.com/MarkPhamm/quickdbd-cli/main/docs/assets/img/gallery/diff.png)](https://markphamm.github.io/quickdbd-cli/demo/diff/)<br>**[Schema diff](https://markphamm.github.io/quickdbd-cli/demo/diff/)**<br>What a branch changed, coloured in: new tables in green, changed columns in amber, removals listed. |
50
+ | [![AdventureWorks](https://raw.githubusercontent.com/MarkPhamm/quickdbd-cli/main/docs/assets/img/gallery/adventureworks.png)](https://markphamm.github.io/quickdbd-cli/demo/adventureworks/)<br>**[AdventureWorks](https://markphamm.github.io/quickdbd-cli/demo/adventureworks/)**<br>Microsoft's bicycle-company OLTP database: 68 tables in five schemas, one region each, with column descriptions. | [![OMOP CDM on Synthea](https://raw.githubusercontent.com/MarkPhamm/quickdbd-cli/main/docs/assets/img/gallery/synthea.png)](https://markphamm.github.io/quickdbd-cli/demo/synthea/#t=concept)<br>**[OMOP CDM on Synthea](https://markphamm.github.io/quickdbd-cli/demo/synthea/#t=concept)**<br>OHDSI's dbt-synthea: synthetic patient records mapped to the OMOP Common Data Model. 145 tables, 235 relationships from tests. |
51
+
52
+ [View all 14 demos →](https://markphamm.github.io/quickdbd-cli/demo/)
53
+ <!-- gallery:end -->
54
+
55
+ ## Quickstart
56
+
57
+ ### Fastest start: try it without installing
58
+
59
+ ```sh
60
+ curl -O https://raw.githubusercontent.com/MarkPhamm/quickdbd-cli/main/examples/quickdbd-sample.txt
61
+ uvx --from quickdbd-cli qdbd serve quickdbd-sample.txt
62
+ ```
63
+
64
+ A browser tab opens with the diagram and an editor. Change the text and the diagram reloads; drag tables to arrange them.
65
+
66
+ ### Or step by step
67
+
68
+ #### 1. Install
69
+
70
+ ```sh
71
+ pipx install quickdbd-cli # or: pip install quickdbd-cli / uv tool install quickdbd-cli
72
+ ```
73
+
74
+ Python 3.11+. See [Install](https://markphamm.github.io/quickdbd-cli/install/) for other options.
75
+
76
+ #### 2. Write a schema, or generate one from dbt
77
+
78
+ Save this as `schema.txt`, or paste in a schema from QuickDBD unchanged:
79
+
80
+ ```text
81
+ Customer
82
+ -
83
+ CustomerId PK int
84
+ Email string UNIQUE
85
+
86
+ Order as o
87
+ ----
88
+ OrderId PK int
89
+ CustomerId int FK >- Customer.CustomerId
90
+ Total decimal(10,2)
91
+ ```
92
+
93
+ A table is a name, a line of dashes, then one column per line. `FK >- Customer.CustomerId` means many orders to one customer. The full syntax is in [Schema Syntax](https://markphamm.github.io/quickdbd-cli/syntax/).
94
+
95
+ For a dbt project, generate the schema instead:
96
+
97
+ ```sh
98
+ dbt docs generate # writes target/manifest.json + catalog.json
99
+ qdbd import dbt target/ -o erd/ --infer-fks # one .txt file per dbt folder
100
+ ```
101
+
102
+ #### 3. Edit it live
103
+
104
+ ```sh
105
+ qdbd serve schema.txt
106
+ ```
107
+
108
+ Edit in the browser or in your own editor; the diagram reloads on save. Dragged positions are saved to `schema.layout.json`, which you commit next to the schema.
109
+
110
+ #### 4. Build, export and share
111
+
112
+ ```sh
113
+ qdbd build schema.txt -o schema.html # one self-contained page
114
+ qdbd export schema.txt -o schema.png # or .svg, .drawio
115
+ qdbd share schema.txt # a link to the page, via a GitHub gist
116
+ ```
117
+
118
+ ## Run in CI
119
+
120
+ The GitHub Action checks the schema and builds the diagram. On pull requests it also posts one schema-diff comment, updated on every push.
121
+
122
+ ```yaml
123
+ # .github/workflows/erd.yml
124
+ name: ERD
125
+ on: [pull_request, push]
126
+ jobs:
127
+ erd:
128
+ runs-on: ubuntu-latest
129
+ permissions: { contents: read, pull-requests: write }
130
+ steps:
131
+ - uses: actions/checkout@v4
132
+ - uses: MarkPhamm/quickdbd-cli@v0.1.11
133
+ with:
134
+ path: erd/ # schema file(s) or folder(s)
135
+ output: site/index.html
136
+ ```
137
+
138
+ dbt projects, GitHub Pages, pre-commit and GitLab CI are covered in [CI and Automation](https://markphamm.github.io/quickdbd-cli/github-action/).
139
+
140
+ ## How qdbd works
141
+
142
+ ```text
143
+ dbt project ──qdbd import dbt──┐
144
+ ├──▶ schema/*.txt (QuickDBD syntax, in git)
145
+ hand-written / pasted ─────────┘ │
146
+ ├──▶ qdbd check validation, QuickDBD's error messages ──▶ CI gate
147
+ ├──▶ qdbd serve live editor, drag to arrange ──▶ schema.layout.json
148
+ ├──▶ qdbd build interactive HTML ──▶ GitHub Pages, artifacts
149
+ ├──▶ qdbd diff what changed vs main ──▶ PR comment
150
+ └──▶ qdbd export PNG · SVG · draw.io ──▶ docs, slides, wikis
151
+ ```
152
+
153
+ - **The parser** follows QuickDBD's own parser step by step, so the same text gives the same tables and the same errors.
154
+ - **The layout** comes from [ELK](https://eclipse.dev/elk/). Positions you drag are saved by table name, and new tables are placed next to the tables they relate to, so the diagram doesn't reshuffle.
155
+ - **One renderer** draws both the page and the images. It runs in the browser, and inside an embedded JavaScript engine for CLI exports, so a PNG always matches the page.
156
+ - **Builds are deterministic**: no timestamps or randomness, so the output only changes when the schema does.
157
+
158
+ ## What it looks like
159
+
160
+ **1. The schema**, a text file in your repo:
161
+
162
+ ```text
163
+ # Every order belongs to one customer.
164
+ Order as o
165
+ ----
166
+ OrderId PK int IDENTITY
167
+ CustomerId int FK >- Customer.CustomerId
168
+ Status string="pending" # current fulfilment state
169
+ ```
170
+
171
+ **2. The command:**
172
+
173
+ ```sh
174
+ qdbd build schema/ -o erd.html
175
+ ```
176
+
177
+ **3. The page:** click a table for its columns, comments and relationships, or type another table's name to get the join path as SQL.
178
+
179
+ ![Table details panel](https://raw.githubusercontent.com/MarkPhamm/quickdbd-cli/main/docs/assets/img/details.png)
180
+
181
+ ## qdbd and QuickDBD
182
+
183
+ | | qdbd | QuickDBD |
184
+ |---|---|---|
185
+ | Text syntax | QuickDBD's | QuickDBD's |
186
+ | Tables per diagram | no limit | 10 on the free plan |
187
+ | Where it runs | your terminal and CI; the result is a static HTML file | the QuickDBD web app |
188
+ | Where the schema lives | `.txt` files in your git repo | the web app |
189
+ | dbt import, schema diffs, PR comments | ✅ | — |
190
+
191
+ Use QuickDBD's editor when you want it: a schema that passes `qdbd check --strict` pastes in unchanged.
192
+
193
+ ## FAQ
194
+
195
+ **Do I need a QuickDBD account?**
196
+ No. qdbd only borrows the text syntax.
197
+
198
+ **Does qdbd connect to my database?**
199
+ No. It reads `.txt` schema files or a dbt `manifest.json`. Nothing connects to a warehouse.
200
+
201
+ **Does my schema leave my machine?**
202
+ Only if you run `qdbd share`, which uploads the page to a GitHub gist in your account (secret by default). `qdbd serve` loads its code editor from a CDN; the built pages load nothing.
203
+
204
+ **How big can a diagram get?**
205
+ The demos go up to 200 tables. Search, selectors, regions and collapsed views keep large diagrams workable; `--select` builds a page with just the part you need.
206
+
207
+ **Can I edit the diagram by hand?**
208
+ You edit the text; the diagram is generated from it. Table positions are the one thing you arrange yourself, by dragging in `qdbd serve`.
209
+
210
+ ## Learn more
211
+
212
+ - [Install](https://markphamm.github.io/quickdbd-cli/install/) and [Quick Start](https://markphamm.github.io/quickdbd-cli/getting-started/)
213
+ - [Schema Syntax](https://markphamm.github.io/quickdbd-cli/syntax/), [many files](https://markphamm.github.io/quickdbd-cli/files/), [table positions](https://markphamm.github.io/quickdbd-cli/layout/), [tags and colours](https://markphamm.github.io/quickdbd-cli/tags/)
214
+ - [Reading the Diagram](https://markphamm.github.io/quickdbd-cli/reading-the-diagram/), [selectors](https://markphamm.github.io/quickdbd-cli/selectors/), [exports](https://markphamm.github.io/quickdbd-cli/exports/), [sharing a link](https://markphamm.github.io/quickdbd-cli/sharing/)
215
+ - [dbt Projects](https://markphamm.github.io/quickdbd-cli/dbt/), with a [jaffle_shop walkthrough](https://markphamm.github.io/quickdbd-cli/example/)
216
+ - [Schema Diffs](https://markphamm.github.io/quickdbd-cli/diffs/), the [GitHub Action](https://markphamm.github.io/quickdbd-cli/github-action/) and the [CLI reference](https://markphamm.github.io/quickdbd-cli/cli/)
217
+ - [Development](https://markphamm.github.io/quickdbd-cli/development/): working on qdbd itself, releasing, and adding a demo
218
+
219
+ ## License
220
+
221
+ Apache-2.0. Bundled third-party files (ELK, Inter) and the sources of the demo schemas are listed in [NOTICE](https://github.com/MarkPhamm/quickdbd-cli/blob/main/NOTICE).
@@ -0,0 +1,25 @@
1
+ Microsoft SQL Server Sample Code
2
+
3
+ Copyright (c) Microsoft Corporation
4
+
5
+ All rights reserved.
6
+
7
+ MIT License.
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in
17
+ all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
+ THE SOFTWARE.
@@ -0,0 +1,11 @@
1
+ Chinook Database
2
+ --------------------------------------
3
+ Copyright (c) 2008-2024 Luis Rocha
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
6
+ documentation files (the "Software"), to deal in the Software without restriction, including without limitation
7
+ the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
8
+ to permit persons to whom the Software is furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
11
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,25 @@
1
+ Microsoft SQL Server Sample Code
2
+
3
+ Copyright (c) Microsoft Corporation
4
+
5
+ All rights reserved.
6
+
7
+ MIT License.
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in
17
+ all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
+ THE SOFTWARE.
@@ -0,0 +1,29 @@
1
+ Sakila Sample Database Schema
2
+ Version 1.5
3
+
4
+ Copyright (c) 2006, 2026, Oracle and/or its affiliates.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are
8
+ met:
9
+
10
+ * Redistributions of source code must retain the above copyright notice,
11
+ this list of conditions and the following disclaimer.
12
+ * Redistributions in binary form must reproduce the above copyright
13
+ notice, this list of conditions and the following disclaimer in the
14
+ documentation and/or other materials provided with the distribution.
15
+ * Neither the name of Oracle nor the names of its contributors may be used
16
+ to endorse or promote products derived from this software without
17
+ specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
20
+ IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
23
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.