iro.offer.smstrade.Smstrade: vProvider now using field argument in Exception.
from iro.model import schema
tables = schema.Base.metadata.sorted_tables
tables_cls={}
for i in dir(schema):
if i.startswith("__") or i == "Base":
continue
try:
a = getattr(schema,i)
tables_cls[a.__tablename__] = a
except AttributeError:
pass
#schema plot
def createSchemaPlot(fname):
from sqlalchemy_schemadisplay3 import create_schema_graph
graph = create_schema_graph(metadata=schema.Base.metadata,
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)
concentrate=True, # Don't try to join the relation lines together
)
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')