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

Hello there

I am writing this node after some unsuccesfully runs of SQL::Translator and its tools. I have a small SQL set of instructions that build 11 tables on a PostgreSQL database. I fed the SQL to sqlt-diagram.pl and sqlt-graph.pl, but the resulting image contains just two of them.

I believe I am not the first Perl programmer who hit the problem, but surely I am not one of those who also solved it...

Thanks in advance

--bronto


The very nature of Perl to be like natural language--inconsistant and full of dwim and special cases--makes it impossible to know it all without simply memorizing the documentation (which is not complete or totally correct anyway).
--John M. Dlugosz

Replies are listed 'Best First'.
Re: Is there any script to translate a simple SQL script to an ER diagram?
by ctilmes (Vicar) on Aug 20, 2003 at 16:49 UTC
    Not sure if it will fully meet your needs, but you might take a look at autodia.
Re: Is there any script to translate a simple SQL script to an ER diagram?
by bronto (Priest) on Aug 20, 2003 at 16:52 UTC

    For the sake of completeness, and in case you know how to solve the problem, this is the SQL code:

    It seems to me that SQL::Translator loses its head with the foreign keys.

    Anyway, if you know another perl tool that does the job, I'll be happy to try it

    Ciao!
    --bronto


    The very nature of Perl to be like natural language--inconsistant and full of dwim and special cases--makes it impossible to know it all without simply memorizing the documentation (which is not complete or totally correct anyway).
    --John M. Dlugosz
      SQL::Translator has worked very well for me. Use the latest from CVS at http://sqlfairy.sourceforge.net/, not the version on CPAN. Support on the mailing list is quite good as well. It handled foreign keys just fine with a MySQL schema I fed it.
      You need bleeedin edge man ;) sql.bronto.t_GraphViz.png

      And just for kicks, this is your psql converted into psql by the sql fairy

      update: That would seem to suggest that the CHECK constraint(?) is somehow mishandled. You should submit a bug report (http://sf.net/projects/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.

        Much much better than my previous results, PodMaster, thanks. But... two tables are missing: PG and ACCESS_LIST...

        --bronto


        The very nature of Perl to be like natural language--inconsistant and full of dwim and special cases--makes it impossible to know it all without simply memorizing the documentation (which is not complete or totally correct anyway).
        --John M. Dlugosz
      What flags, if any, are you using with sqlt_diagram.pl?

        Here you are:

        sqlt-diagram.pl --output grafico.png --db=PostgreSQL createdb.sql

        Same flags for sqlt-graph.pl

        Ciao!
        --bronto


        The very nature of Perl to be like natural language--inconsistant and full of dwim and special cases--makes it impossible to know it all without simply memorizing the documentation (which is not complete or totally correct anyway).
        --John M. Dlugosz