Database to omni/graphviz
Published by peter February 28th, 2007 in java.I was looking for a tool to reverse engineer a datamodel from a database in omnigraffle. I found one or two scripts to do this… but the installation wasn’t even worth the results.
I decided to give it a go myself. Using some calls to the DatabaseMetaData object from JDBC I managed to generate the following omnigraffle diagram (I reverse engineerd the file format, easy… XML) of some of the tables and references between them from my current project (the RDBMS is postgresql):
And the full database (press the ‘x’ key to close the overlay):
which Omni couldn’t layout correctly anymore…
Final layouting was done by the omnigraffle automated layout command, the rest was all generated by my application, for which the code can be found at http://svn.maas-frensch.com/pmutils/JDBCMetadataToOmni/
The application is still very rough, but since it works I’ll probably try and extend it with a more comprehensive CLI or maybe even a GUI…!
I’ve updated the application to write graphviz diagrams as well:
Omnigraffle is capable of rendering graphviz files, but the native renderer seems to be a bit better at writing these sorts of huge diagrams.






















OOoooohh. Pretty. Now make a picture of the entire database schema
I’ll give it a try… not sure if I’m allowed to post it here….
You guys are insane! How can you work with such a huge schema!
Easy, we use Hibernate
Actually the schema isn’t as bad as the diagram might suggest, it’s actually a lot easier to query then the MMBase schema which is currently used to store the application data.
Ouch, that is seriously massive. Hibernate really does a great job at hiding the complexity.
BTW the output file is generated by using velocity templates, which should make it easy to generate any type of file