createerm.py
changeset 313 a88add2b3eea
parent 294 0e75bd39767d
--- a/createerm.py	Tue Apr 15 01:19:47 2025 +0200
+++ b/createerm.py	Tue Apr 15 01:20:56 2025 +0200
@@ -36,8 +36,10 @@
 
 #schema plot
 def createSchemaPlot(fname):
-    from sqlalchemy_schemadisplay3 import create_schema_graph
-    graph = create_schema_graph(metadata=schema.Base.metadata,
+    from sqlalchemy_schemadisplay import create_schema_graph
+    graph = create_schema_graph(engine=None,
+        metadata=schema.Base.metadata,
+        tables=tables,
         show_datatypes=True, # The image too large if datatypes shown
         show_indexes=True, # ditto for indexes
         rankdir='LR', # From left to right (instead of top to bottom)
@@ -47,25 +49,3 @@
     graph.set_size('6.5,10')
     #graph.set_ratio("fill")
     graph.write_svg(fname)
-
-#umlplot
-def createUMLPlot(fname):
-    from sqlalchemy_schemadisplay3 import create_uml_graph
-    from sqlalchemy.orm import class_mapper
-    mappers = []
-    for attr in dir(schema.model):
-        if attr[0] == '_': continue
-        try:
-            cls = getattr(schema.model, attr)
-            mappers.append(class_mapper(cls))
-        except:
-            pass
-    #pass them to the function and set some formatting options
-    graph = create_uml_graph(mappers,
-        show_operations=False, # not necessary in this case
-        show_multiplicity_one=True, # some people like to see the ones
-        show_attributes=True,
-    )
-    graph.set_size('6,5')
-    graph.set_ratio("fill")
-    graph.write_png('test.png')