Does anyone know a way to make an ER diagram from SQLAlchemy models in python 3. I found sqlalchemy_schemadisplay, which is python 2 because of pydot and ERAlchemy which is also python 2 only.
Does anyone know a way to make an ER diagram from SQLAlchemy models in python 3. I found sqlalchemy_schemadisplay, which is python 2 because of pydot and ERAlchemy which is also python 2 only.
As mentioned in an earlier answer, sqlalchemy_schemadisplay is a fantastically simple tool. Here's the basic how you would use it:
from sqlalchemy_schemadisplay import create_schema_graph
from sqlalchemy import MetaData
graph = create_schema_graph(metadata=MetaData('postgres://user:pwd@host/database'))
graph.write_png('my_erd.png')
SQLAlchemy_SchemaDisplay works for me, too.
On Windows I installed Graphviz and these requirements via pip:
Then I added the Grapviz binary (bin) folder to the path and ran the code from the example at https://github.com/sqlalchemy/sqlalchemy/wiki/SchemaDisplay