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 · User manual · 日本語マニュアル

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, or Django 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, or Django 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, or Django 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, and Django 4.2/5.x models. Details and parser boundaries are listed in the compatibility guide.

Project resources

  • Live demo — explore a generated shop schema.
  • 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.8.0.tar.gz (337.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.8.0-py3-none-any.whl (182.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: erdscope-0.8.0.tar.gz
  • Upload date:
  • Size: 337.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.8.0.tar.gz
Algorithm Hash digest
SHA256 72962ce91264b067fadcbd87855a562e05de59a34f8516ddf537ca298274d9ab
MD5 463c29d6065889e1284ded38cefcdcd3
BLAKE2b-256 0cbf4447d8844d6863308c891893f14dc745eb5e62e27d0656d408fbcc570a9a

See more details on using hashes here.

Provenance

The following attestation bundles were made for erdscope-0.8.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.8.0-py3-none-any.whl.

File metadata

  • Download URL: erdscope-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 182.2 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.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d1cfb81ea9e1feab68b220442190d997cb126891ef104d8fe1b9ed3b17ee7b43
MD5 c7ecd9a58861a83ff24ca4543ff2fa77
BLAKE2b-256 918afa48cbd93843b6d6793a23c8bb1163d0651bf95ed3de744eaadbf54e92de

See more details on using hashes here.

Provenance

The following attestation bundles were made for erdscope-0.8.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

0.9.0

2 files

This release

0.8.0 This release

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