Skip to main content
erdscope — explore the schema you have

Database, application code, or config — turn whatever you have into one explorable schema.

CI PyPI Python License

Live demo · Recipes · User manual · 日本語 README

erdscope generates a self-contained, interactive ER diagram and, when you want it, an Excel table-definition workbook. Start with a database, model code, a config file, or any combination of them. The result is one portable HTML file you can explore, share, and keep with your project.

pip install erdscope
erdscope demo

That is the whole quickstart. A sample shop diagram opens in your browser—no database, account, or project setup required.

Interactive diagram generated by erdscope

Bring whatever schema you have

Database, application code, and config merge into an interactive ER diagram and Excel workbook
Start from What erdscope reads Good for
A database MySQL, PostgreSQL, or SQLite catalogs Exploring the schema that is actually deployed
Application code Rails, Prisma, Django, SQLAlchemy, or Laravel projects Reviewing a project without database access
Config JSON or YAML source declarations, tables, relations, notes, and groups Reusing settings, designing a schema, or adding documentation

Use just one source, or combine them. Physical database facts, application-level associations, and your explicit documentation are merged into one consistent view.

The examples below use CLI arguments when that makes the input obvious. For repeatable usage, put the same settings and model sources in .erdscope.json, .erdscope.yml, or another file selected with --config. A config can also define a complete schema by itself. Explicit CLI arguments override the corresponding config values.

Pick your starting point

Explore a live database

erdscope postgres://readonly@127.0.0.1:5432/myapp -o schema.html

MySQL uses the same shape. SQLite needs no driver and works with Python's standard library:

erdscope sqlite:///path/to/app.db -o schema.html

Review application models without a database

# Rails, Prisma, Django, SQLAlchemy, or Laravel project — auto-detected
erdscope --models ./my-app -o schema.html

Sketch or document a schema from config alone

erdscope --config examples/schema-only.json -o schema.html

examples/schema-only.json is a complete, zero-database example with tables, relations, notes, and a domain group. Config can also patch or remove items supplied by another source. See the config guide.

Combine database facts, application context, and documentation

erdscope mysql://readonly@127.0.0.1:3306/myapp \
  --config .erdscope.yml \
  -o schema.html
# .erdscope.yml
models:
  - ./app/models
groups:
  - { id: sales, title: Sales, tables: [orders, order_items] }
notes:
  - id: order-retention
    target: { type: table, table: orders }
    text: Orders are retained for seven years after account closure.

This is where the layered input model shines: use the database for columns and real foreign keys, code for associations such as polymorphic or through relations, and config for corrections, domain groups, operational notes, and ADR links.

Hand off both a diagram and table definitions

erdscope sqlite:///path/to/app.db \
  -o schema.html \
  --excel table-definitions.xlsx

The HTML is self-contained and the workbook can be styled with an Excel template—useful for reviews, audits, onboarding, and documentation deliverables.

What you can do in the viewer

  • Search tables, columns, comments, and attached notes.
  • Focus on dependencies or dependents and control traversal depth.
  • Hide tables, rearrange the layout, and move domain groups together.
  • Inspect DB FKs, schema FKs, declared associations, and inferred relations.
  • Save named views and share a link to the current view.
  • Export the current canvas as PNG or SVG, or print it cleanly.
  • Switch to dark mode; everything runs locally in the generated HTML.

Try these interactions in the live demo, or use the illustrated viewer guide.

Installation

pip install erdscope

The core CLI, SQLite reader, HTML generator, and Excel writer use only the Python standard library. Install an optional driver when you want a direct server connection:

pip install 'erdscope[mysql]'     # PyMySQL
pip install 'erdscope[postgres]'  # psycopg
pip install 'erdscope[yaml]'      # PyYAML for .yml/.yaml config
pip install 'erdscope[all]'

Prefer a single file? Download erd.py and run it with Python 3.9+:

python3 erd.py demo

Config and CLI overrides

Config is the convenient home for recurring inputs and settings. It is auto-discovered as .erdscope.json, .erdscope.yml, or .erdscope.yaml in the current directory, or you can select a file with --config. When the same setting is supplied both ways, the explicit CLI argument wins.

Option Purpose
--config PATH Load model sources, defaults, schema definitions or patches, notes, and groups
--models PATH Override config models with Rails, Prisma, Django, SQLAlchemy, or Laravel input; repeatable
--excel FILE.xlsx Also generate a table-definition workbook (includes Notes/Groups sheets when configured)
--emit-json FILE.json Also write a canonical JSON schema snapshot with a content fingerprint (- for stdout)
--emit-config FILE.yml|.json Also write the schema as a config-authoring file, re-importable via --config (- for stdout, always JSON)
--diff SNAPSHOT.json Compare this run against a saved --emit-json snapshot and exit 0/1/2 instead of generating output (CI drift gate)
--emit-digest FILE.md Also write a token-efficient Markdown digest of the schema, with design notes, for LLMs/agents (- for stdout; --digest-verbose adds nullable/default/sql_type)
--emit-dbml FILE.dbml Also write a minimal DBML export of the schema — tables/columns/indexes/single-column-FK relations/table comments (- for stdout; no notes/groups/TableGroup)
--emit-mermaid FILE.mmd Also write a Mermaid erDiagram export of the schema — tables/columns/PK-FK markers/relationships (- for stdout; no notes/groups)
--emit-plantuml FILE.puml Also write a PlantUML entity-relationship export of the schema — tables/columns/PK-FK markers/relationships (- for stdout; no notes/groups)
--only 'user*,order*' Generate only matching tables
--exclude '*_logs' Leave matching tables out
--infer-fk Add clearly marked relation guesses from *_id columns
--no-open Do not open the browser after demo

For every option and config key, see the CLI and config reference.

Supported inputs

erdscope is tested against MySQL 8.4, PostgreSQL 16, CPython's bundled SQLite, Rails 7.x/8.x projects, Prisma 5/6 schemas, Django 4.2/5.x models, SQLAlchemy declarative models (classic and 2.0 styles), and Laravel Eloquent models. Details and parser boundaries are listed in the compatibility guide.

Project resources

  • Live demo — explore a generated shop schema.
  • Recipes — task-oriented guides with copy-paste commands (日本語).
  • User manual — complete setup, viewer, config, export, and troubleshooting guide.
  • Examples — ready-to-run SQLite and config-only inputs.
  • Changelog — features and behavior by release.
  • Issues — bug reports and feature requests.

Development

Source lives under src/erdscope/; the distributable erd.py is generated from it.

python3 -m unittest discover -s tests -v
python3 tools/build_single_file.py --check

See the engineering quickstart before changing providers, merge behavior, the viewer, or generated artifacts.

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

erdscope-0.9.0.tar.gz (356.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

erdscope-0.9.0-py3-none-any.whl (193.1 kB view details)

Uploaded Python 3

File details

Details for the file erdscope-0.9.0.tar.gz.

File metadata

  • Download URL: erdscope-0.9.0.tar.gz
  • Upload date:
  • Size: 356.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for erdscope-0.9.0.tar.gz
Algorithm Hash digest
SHA256 6430b649e73712dbe4604ad9510de80a8149b820bf7c5e69e96d734f8f870992
MD5 39adeab59bad1d0d83baf44dd5887586
BLAKE2b-256 71d1ce6cabdea2fd69d73587de964da68a02cfed70d810d5940b5e8ffb8290a2

See more details on using hashes here.

Provenance

The following attestation bundles were made for erdscope-0.9.0.tar.gz:

Publisher: release.yml on orapli/erdscope

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file erdscope-0.9.0-py3-none-any.whl.

File metadata

  • Download URL: erdscope-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 193.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for erdscope-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 359c2a4efc910a58e357a2512e4d91fffc2d5388c44a346b9c233d41bd388ddc
MD5 806c9ef6a07d6c81eec4a9aac6c69b94
BLAKE2b-256 b408eeea7e3c0416f1b625b9af933490f59458206a64f133b4bffde8efd7dbe1

See more details on using hashes here.

Provenance

The following attestation bundles were made for erdscope-0.9.0-py3-none-any.whl:

Publisher: release.yml on orapli/erdscope

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.12.2

2 files

0.12.1

2 files

0.12.0

2 files

0.11.3

2 files

0.11.2

2 files

0.11.1

2 files

0.11.0

2 files

0.10.0

2 files

0.9.1

2 files

This release

0.9.0 This release

2 files

0.8.0

2 files

0.7.2

2 files

0.7.1

2 files

0.7.0

2 files

0.6.0

2 files

0.5.0

2 files

0.4.1

2 files

0.4.0

2 files

0.3.0

2 files

0.2.0

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page