Note: I’ve since found better software for visualizing sql data models. I highly recommend dbeaver please consider buying this free software
This was harder than it should have been so I’m documenting it.
java -jar <schemaspy jar> -t pgsql -db <database name> -u <user> -host localhost -o <output directory> -s "public" -dp <jdbc driver>
for a remote database (say on Amazon RDS) try
java -jar <schemaspy jar> -t pgsql -db <database name> -u <user> -p <password> -host foo.bar.region.rds.amazonaws.com -o <output directory> -s "public" -dp <jdbc driver>
If you get a complaint about the schema, it defaults to the username, pass in the correct schema name after -s
.
now you can open <output directory>/index.html
to get amazing info on your postgres database.
Above is the output for the dellstore2 datamodel. You can drill down to focus on a single table and its relationships. Let’s isolate ‘Orders’.
You can test it out yourself dellstore SchemaSpy.
Hopefully someday I’ll be able to get a postgres schema to load in wwwsqldesigner but I couldn’t figure it out. This way I could send my friends a link to my data model.
For other applications, like weka you would want to place the jdbc driver in the classpath.
If you need help solving your business problems with software read how to hire me.