jts_erd

Generate an entity-relationship diagram from an extended JSON table schema.

JSON table schema is a simple schema for describing the structure of tabular data. It can be extended to allow for a comprehensive representation of an SQL relational database schema.

Starting from such a description this python module generates visualizations of the database schema using graphviz via PyGraphviz.

jts_erd.jts_erd.get_graph(json_table_schema, **options)[source]

Create and return a graph from the given json_table_schema.

All keys from options_defaults are allowed in kwargs.

jts_erd.jts_erd.options_defaults = {'bgcolor_indexes': '#ccccff', 'default_namespace_name': 'public', 'display_columns': True, 'display_crowfoots': True, 'display_indexes': True, 'display_tooltips': True, 'edge_thickness': 1.0, 'fontname': 'Helvetica', 'fontsize': 8, 'fontsize_label': 6, 'fontsize_title': 10, 'html_color_default': '#ccff99', 'html_color_header': 'lightgrey', 'html_color_header_for_table': {}, 'html_color_highlight': '#33cc99', 'omit_isolated_tables': False, 'rankdir': 'LR', 'table_comment_wrap_width': 70}

Options and their default values.

Options:

  • html_color_header

  • html_color_header_for_table

  • html_color_default

  • html_color_highlight

  • fontname

  • fontsize

  • fontsize_title

  • fontsize_label

  • bgcolor_indexes

  • rankdir: ‘LR’ or ‘RL’; whether dependent tables appear on the right (left) hand side

  • edge_thickness

  • display_columns: bool

  • display_indexes: bool

  • display_crowfoots: bool

  • display_tooltips: bool

  • omit_isolated_tables: bool

  • default_namespace_name: string

jts_erd.jts_erd.save_svg(json_database_schema, filepath, **options)[source]

Write an ERD in SVG format for a database to a file.

json_database_schema must be compatible with what pg_jts produces. filepath must end in ‘.svg’.