http://qs321.pair.com?node_id=384596

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Does anyone know of an existing module that will connect to a database and spit out the ERD of that database?

I get real tired of creating data diagrams whenever I make a new table in my db. It would be great if there was some mod that combines DBI and GD.

Any thoughts?

Monkified

Replies are listed 'Best First'.
Re: ERD Diagram Generation
by adrianh (Chancellor) on Aug 20, 2004 at 14:32 UTC
      SQL::Translator has a good web frontened called sqlt.cgi. You can just paste schema code into a textbox and see a decent diagram. You could automate schema diagrams if your database has a command for dumping schemas. I'd also recommend checking out GraphViz::DBI, Class::DBI::Loader::GraphViz though you'd have to define relationships.
Re: ERD Diagram Generation
by Grygonos (Chaplain) on Aug 20, 2004 at 14:37 UTC

    All the methods needed to generate an ERD diagram in GD are present in the DBI module. The methods table_info, column_info, primary_key_info, foreign_key_info sound like exactly what you want/need to gather the data neccesary for your ERD diags. I think it would be a really fun module to write.

      Alzabo does this already. It will do the reverse engineerings and will produce pictures of the results.
Re: ERD Diagram Generation
by dragonchild (Archbishop) on Aug 20, 2004 at 14:38 UTC
    There are also a number of very good third-party tools that will do this. Some only work with specific databases, such as Oracle or SQL*Server. Caveat - few, if any, of these tools are free. Some may be OpenSource, but I'm not sure.

    ------
    We are the carpenters and bricklayers of the Information Age.

    Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

    I shouldn't have to say this, but any code, unless otherwise stated, is untested

Re: ERD Diagram Generation
by PodMaster (Abbot) on Aug 21, 2004 at 10:13 UTC
    Try schemaball. It uses the sqlfairy :)

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.