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_database_schema, **options)[source]

Create and return a graph from the given json_database_schema.

All keys from options_defaults are allowed in kwargs.

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

Options and their default values.

Options:

  • 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
  • omit_isolated_tables: bool
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’.