Skip to content

enorganic/db-diagram

Repository files navigation

db-diagram

test PyPI version

This package provides a CLI and library for generating Mermaid Entity Relationship Diagrams based on an existing database connection URL and/or SQLAlchemy metadata.

ab_group_role.mmd.svg

Installation

You can install db-diagram with pip:

pip3 install db-diagram

You will also need to have libraries installed for the SQLAlchemy dialect corresponding to your database, unless you are using MySQL/MariaDB or SQLite. For convenience, installation extras are defined for a handful of dialects:

  • pip3 install 'db-diagram[postgresql]'
  • pip3 install 'db-diagram[snowflake]'
  • pip3 install 'db-diagram[databricks]'

Usage

You can utilize db-diagram as a CLI (from a shell or command prompt), or as a python library (from db_diagram import write_markdown). The CLI will be more convenient under most circumstances, however if you want to generate diagrams from SQLAlchemy metadata rather than a connection URL, such as you might for a SQLAlchemy ORM, you will want to use db_diagram as a python library. Pease refer to these examples for reference concerning output.

About

Generate entity relationship diagrams from an existing database

Resources

Stars

Watchers

Forks

Packages

No packages published