SQLAlchemy ER diagram in python 3

后端 未结 3 2083
Happy的楠姐
Happy的楠姐 2021-02-05 18:11

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

3条回答
  •  再見小時候
    2021-02-05 19:14

    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')
    

提交回复
热议问题