Go to file
Luís Moreira de Sousa 4030b0417b Column type length now removed automatically (Mermaid can't use it) 2022-06-09 14:12:54 +02:00
.gitignore Adds proper configuration file 2022-06-09 12:03:57 +02:00
README.md Updates README with install instructions and adds requirements.txt file 2022-06-09 12:13:49 +02:00
auter.py Column type length now removed automatically (Mermaid can't use it) 2022-06-09 14:12:54 +02:00
config.dist Adds proper configuration file 2022-06-09 12:03:57 +02:00
requirements.txt Updates README with install instructions and adds requirements.txt file 2022-06-09 12:13:49 +02:00

README.md

Auter - automated E-R diagrams

This programs uses SQLAlchemy to inspect a relational database and generate a E-R diagram configuration for Mermaid.

Getting ready

Start by creating a virtual environment:

python3 -m venv env

source env/bin/activate

Install the necessary libraries:

pip3 install -r requirements.txt

At this stage you might need to install additional libraries specific to the target DBMS. For instance, Postgres requires the psycopg2 library:

pip3 install psycopg2

Create a new config file:

cp config.dist config

Open the config with your favourite file editor and modify the settings to your needs. The connection string follows the SQLAlchemy conventions.

vim config

Usage

Pass a list of table names as arguments to auter.py. The programme creates markdown for all of these and any other tables referring to them:

python3 auter.py my_table my_other_table > out.mm

Then use mermaid to create an image from the markdown file:

mmdc -i out.mm -o out.png

Finally display the image with a programme like eog:

eog out.png

Markdown embedding

By now, all the three major git-based software forges support mermaid diagrams embedded in Markdown documents: Gitea, GitLab and GitHub. You can get the mermaid code directly in the command line with auter:

python3 auter.py my_table my_other_table