Skip to content

Instantly share code, notes, and snippets.

@tomsing1
Created October 25, 2017 00:25
Show Gist options
  • Save tomsing1/227ebe4ae40a5f22af18644ee0788e77 to your computer and use it in GitHub Desktop.
Save tomsing1/227ebe4ae40a5f22af18644ee0788e77 to your computer and use it in GitHub Desktop.
Creating an html report for a Postgres database using schemaSpy

schemaSpy

Here's how to use it to generate schema relationship diagrams for PostgreSQL databases.

Prerequisites

  1. Download the jar file from here (the current version is schemaSpy_5.0.0.jar)
    • Note: There is a release candidate for version 6, but I couldn't get that to play nicely with graphviz on Mac OS 10.13
  2. Get the PostgreSQL JDBC driver (either the JDBC3 or JDBC4 jar file is fine)
  3. Install graphviz
brew install graphviz

Create the report

java -jar ~/Downloads/schemaSpy_5.0.0.jar -renderer :quartz -t pgsql -db dnli -u sandmann -o /tmp -dp ~/Downloads/postgresql-42.1.4.jar -s public -host localhost

The index.html file is generated at /tmp/index.html.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment