semql-erd
ER-diagram generator for semql catalogs. Walks the
cubes and joins in a Catalog and emits a Graphviz
DOT source (and convenience PNG/SVG when the graphviz Python bindings
- system
dotbinary are available).
Useful when:
- The catalog is past 10 cubes and reading the YAML/Python isn't enough to see the join shape at a glance.
- A PR touches a
Joinand the reviewer wants a visual diff of the before / after graph. - Onboarding docs need a stable picture of what's in scope.
Install
pip install semql-erd # DOT source only — no system deps
pip install "semql-erd[image]" # + graphviz Python bindings
# (also needs the `dot` binary)
Quick start — DOT source
render_dot(catalog) is dependency-free: it produces a DOT-language
string you can paste into any Graphviz renderer
(Edotor is a quick web one).
from semql import Dialect, Catalog, Cube, Dimension, Join, Measure
from semql_erd import render_dot
orders = Cube(
name="orders",
dialect=Dialect.POSTGRES,
table="orders",
alias="o",
measures=[Measure(name="revenue", sql="{o}.amount", agg="sum", unit="currency")],
dimensions=[Dimension(name="region", sql="{o}.region", type="string")],
joins=[Join(to="customers", relationship="many_to_one", on="{o}.cid = {c}.id")],
)
customers = Cube(
name="customers",
dialect=Dialect.POSTGRES,
table="customers",
alias="c",
dimensions=[Dimension(name="name", sql="{c}.name", type="string")],
)
print(render_dot(Catalog([orders, customers])))
Quick start — PNG/SVG
from semql_erd import render_image
# Requires `pip install "semql-erd[image]"` AND the `dot` binary on PATH.
render_image(catalog, "catalog.png") # PNG by default
render_image(catalog, "catalog.svg", format="svg")
Conventions
- Nodes are cubes. The label is a Graphviz record showing the cube
name (+
display_namesuffix if set), the backend, and three field sections (measures, dimensions, time-dimensions). - Edges are
Joins. Arrowhead shape encodes the relationship:many_to_one→crowon the from-side,teeon the to-sideone_to_many→ mirror of the aboveone_to_one→teeon both sides
- Filtering mirrors the planner prompt: by default only cubes with
expose_in_prompt=True(and non-META cubes) appear. Passonly_exposed=Falsefor a full graph. - Layout defaults to
rankdir="LR"(left-to-right). Passrankdir="TB"for top-to-bottom.
CLI
python -m semql_erd path.to.module:catalog # prints DOT to stdout
python -m semql_erd path.to.module:catalog out.svg # writes a rendered image
Status
Early development. The DOT format is stable; record-section ordering and node ID naming may evolve.
Release files for semql-erd 0.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| semql_erd-0.7.0.tar.gz | 7.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| semql_erd-0.7.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.1 kB
Release files / semql_erd-0.7.0.tar.gz
| Download URL | semql_erd-0.7.0.tar.gz |
|---|---|
| Size | 7.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
74d97653d4ff181738a8314f0948615f74c9a00f909a03538fb8e37f9e50f17b
|
|
BLAKE2b-256 checksum How to use checksums |
1f1447f2e2d6da236da38c5858a130adf8654be467268ec7ff86f7324b9c2d4b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 21, 2026.
Transparency logRelease files / semql_erd-0.7.0-py3-none-any.whl
| Download URL | semql_erd-0.7.0-py3-none-any.whl |
|---|---|
| Size | 9.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
37e6520300d0b6e893ea966162ff0c59eb90264a21fec08ebca576e60cf2888e
|
|
BLAKE2b-256 checksum How to use checksums |
0ece4dc5510a9aee24e65df9310acf88e1e78d75f986e99315d1d70d95ae9a07
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 21, 2026.
Transparency log