Database to omni/graphviz

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):

omnigraffle output
And the full database (press the ‘x’ key to close the overlay):
full database
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:

Graphviz output

Omnigraffle is capable of rendering graphviz files, but the native renderer seems to be a bit better at writing these sorts of huge diagrams.


7 Responses to “Database to omni/graphviz”

  1. 1 arne

    OOoooohh. Pretty. Now make a picture of the entire database schema :)

  2. 2 peter

    I’ll give it a try… not sure if I’m allowed to post it here….

  3. 3 erikvanoosten

    You guys are insane! How can you work with such a huge schema!

  4. 4 peter

    Easy, we use Hibernate ;-)

  5. 5 peter

    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.

  6. 6 arne

    Ouch, that is seriously massive. Hibernate really does a great job at hiding the complexity.

  7. 7 peter

    BTW the output file is generated by using velocity templates, which should make it easy to generate any type of file

Leave a Reply





About

Welcome to the weblog of Peter Maas. Here you'll find various posts related to stuff I like (like my kids and espresso) and stuff I do (like developing software).

JavaOne 2008 Pictures


Joshua Bloch at JavaOne2008 Stretched Limo Stage being build in the nearby park Charles Nutter & Guillaume Laforge sea_lion Rudie Greenland Hotel room Cable Car line Acme Anvile at CommunityOne Keynote Community One Keynote Java + You on a cab javaone 2008 goodybag pub nearby hotel Moscone Center - JavaOne smashmouth golden_gate_warning_sign javaone2008 keynote alcatraz
View more photos >

Categories



Meld u aan voor PayPal en begin direct met het accepteren van creditcardbetalingen.