コード例 #1
0
def from_dot(filename, strict=True, directed=True, string=None):
    """
	
	:param filename:
	:param strict:
	:param directed:
	:param string:
	:return:
	"""

    A = AGraph(directed=directed, strict=strict)
    with open(filename) as reader:
        data = reader.read()
    A.from_string(data)
    return A
コード例 #2
0
def intermediary_to_schema(tables, relationships, output):
    """ Transforms and save the intermediary representation to the file chosen. """
    dot_file = _intermediary_to_dot(tables, relationships)
    graph = AGraph()
    graph = graph.from_string(dot_file)
    extension = output.split('.')[-1]
    graph.draw(path=output, prog='dot', format=extension)
コード例 #3
0
ファイル: main.py プロジェクト: jasondyjohnson/eralchemy
def intermediary_to_schema(tables, relationships, output):
    """ Transforms and save the intermediary representation to the file chosen. """
    dot_file = _intermediary_to_dot(tables, relationships)
    graph = AGraph()
    graph = graph.from_string(dot_file)
    extension = output.split('.')[-1]
    graph.draw(path=output, prog='dot', format=extension)
コード例 #4
0
ファイル: main.py プロジェクト: vranac/erdammer
def export_table_to_svg(output_directory, tables, output_format='svg', layout_using='neato'):
    for table in tables:
        table_dot = '\n' + table.to_dot()
        dot_file = '{}\n{}\n}}'.format(GRAPH_BEGINNING, table_dot)

        graph = AGraph(directed=True)
        graph = graph.from_string(dot_file)
        graph.draw(path=output_directory + "/{}.{}".format(table.name, output_format), prog=layout_using, format=output_format)
コード例 #5
0
ファイル: main.py プロジェクト: vranac/erdammer
def export_to_svg(output_directory, tables, relationships, svg_per_table, output_name='erd', output_format='svg', layout_using='neato', **kwargs):
    if svg_per_table:
        export_table_to_svg(output_directory=output_directory, tables=tables)

    tables_dot = '\n'.join(table.to_dot() for table in tables)
    relationships_dot = '\n'.join(relationship.to_dot() for relationship in relationships)
    dot_file = '{}\n{}\n{}\n}}'.format(GRAPH_BEGINNING, tables_dot, relationships_dot)

    graph = AGraph()
    graph = graph.from_string(dot_file)
    graph.draw(path=output_directory + "/{}.{}".format(output_name, output_format), prog=layout_using, format=output_format)