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
--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)
--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.7.0.tar.gz (285.5 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.7.0-py3-none-any.whl (150.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for erdscope-0.7.0.tar.gz
Algorithm Hash digest
SHA256 542fd708c1fa61988d01294d548072df4bd458678042613009dd2546271e4868
MD5 a472b1bc11e1d19477e453ee933894ab
BLAKE2b-256 21944afb6f4889e77deb62b4f432b8130a52a5b334ab458cf098a5f9eb09721a

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: erdscope-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 150.5 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.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a4d8e33aa4a42daf1e598af168bf95153528d0c78573534fdea983dd40d0c68e
MD5 1bd723bb9670ca553179e505c29916ea
BLAKE2b-256 ed958d752c85e33cacaaded4a7e45fffa44b9f1b7475136a462b7d21deeaaf85

See more details on using hashes here.

Provenance

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

0.8.0

2 files

0.7.2

2 files

0.7.1

2 files

This release

0.7.0 This release

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