Module Import alias Import alias Import alias ImportFrom alias alias alias alias alias TryExcept body Import alias handlers ExceptHandler type NameLoad body Print Str Assign NameStore Dict Str Str Str Str Str Str Assign NameStore Dict Str Str Str Str Str Str Str Str Assign NameStore Dict Str Str Str Str Str Str Str Str Assign NameStore Dict Str Str FunctionDef arguments args defaults body Print Str decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr Str Return TupleLoad BinOpAdd Call AttributeLoad NameLoad attr Str Num NameLoad Num BinOpAdd Call AttributeLoad NameLoad attr Str NameLoad Call NameLoad NameLoad Num decorator_list FunctionDef arguments args NameParam NameParam defaults body If CompareIn Str NameLoad body Assign TupleStore NameStore NameStore Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Slice NameLoad NameLoad Assign NameStore BinOpAdd SubscriptLoad NameLoad Slice Num NameLoad SubscriptLoad NameLoad Slice NameLoad Assign TupleStore NameStore NameStore Call NameLoad NameLoad NameLoad Return TupleLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore ListLoad Assign TupleStore NameStore NameStore Call NameLoad NameLoad ListLoad For NameStore Call AttributeLoad NameLoad attr Str body If UnaryOpNot NameLoad body Continue If CompareEq Call AttributeLoad NameLoad attr Str Num body Assign NameStore NameLoad orelse Assign NameStore NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Return Dict Str Str NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body With Call AttributeLoad NameLoad attr NameLoad NameStore body Assign NameStore Call AttributeLoad NameLoad attr Return ListComp SubscriptLoad NameLoad Index Num comprehension NameStore Call AttributeLoad NameLoad attr Str decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Dict For NameStore NameLoad body If Call AttributeLoad NameLoad attr Str body Assign NameStore Call AttributeLoad NameLoad attr Str NameLoad If NameLoad body Assign SubscriptStore NameLoad Index Call AttributeLoad NameLoad attr Num Call NameLoad Call AttributeLoad NameLoad attr Num Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body For TupleStore NameStore NameStore Call AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad Str attr SubscriptLoad NameLoad Index Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Assign SubscriptStore SubscriptLoad NameLoad Index NameLoad Index Str NameLoad Assign SubscriptStore SubscriptLoad NameLoad Index NameLoad Index Str NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body For NameStore Call AttributeLoad NameLoad attr body For NameStore SubscriptLoad NameLoad Index Str body Assign NameStore SubscriptLoad Call AttributeLoad NameLoad attr Str Index Num Assign NameStore SubscriptLoad Call AttributeLoad NameLoad attr Index Num Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Str SubscriptLoad SubscriptLoad NameLoad Index NameLoad Index Str keyword NameLoad keyword Call AttributeLoad SubscriptLoad NameLoad Index Str attr keyword Call AttributeLoad SubscriptLoad SubscriptLoad NameLoad Index NameLoad Index Str attr decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call NameLoad NameLoad NameLoad Expr Call NameLoad NameLoad NameLoad Return NameLoad decorator_list If CompareEq NameLoad Str body If CompareLt Call NameLoad AttributeLoad NameLoad attr Num body Expr Call NameLoad Expr Call AttributeLoad NameLoad attr Num Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index Num Assign NameStore Call NameLoad Call NameLoad NameLoad Assign NameStore SubscriptLoad Call NameLoad Call NameLoad NameLoad Index Num Assign NameStore Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr BinOpMod Str NameLoad Print Str
N/A N/A re N/A sqlite3 N/A sys os.path abspath basename dirname join splitext N/A N/A N/A pydot N/A N/A N/A ImportError N/A N/A You need to have pydot and Graphviz installed.

To install Graphviz:
http://www.graphviz.org/Download.php

OR:

Use your OS's package manager.

To install pydot:
$ pip install pydot
 N/A DOT_DEFAULTS N/A graph_type compound rankdir digraph true LR N/A GRAPH_DEFAULTS N/A fontsize fontname style fillcolor 12.0 times-bold filled azure2 N/A NODE_DEFAULTS N/A shape fontsize style fillcolor box 8.0 filled white N/A EDGE_DEFAULTS N/A fontsize 8.0 print_usage N/A N/A N/A N/A N/A Usage: python create_database_diagram_from_database_file.py [databasefile]
 N/A get_indeces N/A N/A string N/A N/A N/A paren_index N/A N/A string find ( N/A N/A N/A N/A N/A string rfind , 0 paren_index 2 N/A N/A N/A string find ) paren_index N/A len string 1 N/A handle_constraint_fields N/A N/A string fields N/A N/A N/A N/A ( string N/A N/A N/A start_index end_index N/A get_indeces string N/A N/A N/A fields append N/A string N/A start_index end_index N/A string N/A N/A string N/A 0 start_index N/A string N/A end_index N/A N/A string fields N/A handle_constraint_fields string fields N/A N/A string fields N/A split_foreign_keys_and_rest N/A N/A string N/A N/A N/A fks N/A N/A N/A string fields N/A handle_constraint_fields string N/A N/A token N/A N/A string split ,  N/A N/A N/A token N/A N/A N/A N/A N/A N/A token find REFERENCES -1 N/A N/A l fields N/A N/A l fks N/A N/A N/A l append token N/A N/A fields fks fields fks N/A get_schema N/A N/A db_file N/A N/A N/A N/A N/A sqlite3 connect db_file conn N/A N/A c N/A N/A conn cursor N/A N/A N/A row N/A 0 N/A row N/A N/A c execute SELECT sql FROM sqlite_master WHERE type='table' N/A organize_rows N/A N/A sql_lines N/A N/A N/A data N/A N/A line sql_lines N/A N/A N/A N/A line startswith CREATE TABLE N/A N/A m N/A N/A re match CREATE TABLE (\w+) \((.*)\) line N/A m N/A N/A N/A data N/A N/A N/A m group 1 N/A split_foreign_keys_and_rest N/A N/A m group 2 N/A data N/A populate_nodes_and_clusters N/A N/A data graph N/A N/A N/A N/A table_name value N/A N/A data iteritems N/A N/A node N/A N/A pydot Node N/A N/A join N/A value N/A fields N/A cluster N/A N/A pydot Cluster table_name label table_name N/A N/A N/A cluster add_node node N/A N/A N/A graph add_subgraph cluster N/A N/A N/A data N/A table_name N/A node node N/A N/A N/A data N/A table_name N/A cluster cluster N/A populate_edges N/A N/A data graph N/A N/A N/A table_data N/A N/A data itervalues N/A N/A fk N/A table_data N/A fks N/A N/A target N/A N/A N/A fk split  REFERENCES  N/A 1 N/A target_name N/A N/A N/A fk split N/A 0 N/A N/A N/A graph add_edge N/A N/A pydot Edge N/A table_data N/A node N/A N/A data N/A target N/A node label target_name ltail N/A N/A N/A table_data N/A cluster get_name lhead N/A N/A N/A N/A data N/A target N/A cluster get_name N/A create_graph N/A N/A data N/A N/A N/A graph N/A N/A pydot Dot DOT_DEFAULTS N/A N/A N/A graph set_graph_defaults GRAPH_DEFAULTS N/A N/A N/A graph set_node_defaults NODE_DEFAULTS N/A N/A N/A graph set_edge_defaults EDGE_DEFAULTS N/A N/A populate_nodes_and_clusters data graph N/A N/A populate_edges data graph N/A graph N/A N/A N/A __name__ __main__ N/A N/A N/A N/A len N/A sys argv 2 N/A N/A N/A print_usage N/A N/A N/A sys exit 1 N/A file_name N/A N/A sys argv N/A 1 N/A data N/A organize_rows N/A get_schema file_name N/A file_name N/A N/A splitext N/A basename file_name N/A 0 N/A graph N/A create_graph data N/A N/A N/A graph write_png N/A %s.png file_name N/A DONE