jts_erd Documentation
Release 0.0.1

ibu radempa

October 18, 2015

Contents

1Introduction

32Installation

53

Usage examples

74API
4.1 jts_erd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

99Python Module Index

11i

ii

jts_erd Documentation, Release 0.0.1

jts_erd creates an ERD (entity-relationship diagram).
It requires an extension of a json-table-schema as input.
Depends on pygraphviz.

Contents1

jts_erd Documentation, Release 0.0.1

2

Contents

CHAPTER 1Introduction

For now please look at these slides: 20150927_talk.pdf
TL;DR Generate an entyty-relationship diagram for a schema given as JSON-table-schema.
Example of a resulting ERD:3

jts_erd Documentation, Release 0.0.1

4Chapter 1. Introduction

CHAPTER 2Installation

Install graphviz and build tools:
aptitude install pkg-config build-essential graphviz libgraphviz-dev

You will need at least PyGraphviz 1.3.1 when using python3.
Currently (as of version 1.3.1 of pygraphviz) on at least debian and ubuntu you need special install options due to abug (https://github.com/pygraphviz/pygraphviz/issues/71):

pip3 install pygraphviz --install-option="--include-path=/usr/include/graphviz" --install-option="--l(gcc still throws a warning.)
Prepare a virtualenv with python3:
mkdir jts_erd
cd jts_erd
virtualenv -p python3
source bin/activate

In the virtualenv root dir:git clone https://github.com/iburadempa/jts_erd.git

5jts_erd Documentation, Release 0.0.1

6Chapter 2. Installation

CHAPTER 3

Usage examples

The main function jts_erd.get_graph() creates a graphviz graph from a (JSON-decoded) JSON-table-schema.
An accompanying function, jts_erd.save_svg(), renders a graph in SVG format and saves it.
For examples look at the examples directory, https://github.com/iburadempa/jts_erd/tree/master/examples

7jts_erd Documentation, Release 0.0.1

8Chapter 3. Usage examples

CHAPTER 4

API4.1 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 acomprehensive 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)
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 = {‘fontsize_label’: 6, ‘edge_thickness’: 1.0, ‘omit_isolated_tables’: False, ‘display
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: bool9

jts_erd Documentation, Release 0.0.1

jts_erd.jts_erd.save_svg(json_database_schema, filepath, **options)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’.
Source: https://github.com/iburadempa/jts_erd/

10Chapter 4. API

Python Module Indexjjts_erd, 1
jts_erd.jts_erd, 911jts_erd Documentation, Release 0.0.1

12

Python Module Index

IndexG
get_graph() (in module jts_erd.jts_erd), 9J
jts_erd (module), 1
jts_erd.jts_erd (module), 9O
options_defaults (in module jts_erd.jts_erd), 9S
save_svg() (in module jts_erd.jts_erd), 913