SQL::Translator, sqlt-diff confusion I have many schema I wish to compare,
SQL::Translator::Manual shows this example sqlt-diff foo-v1.sql=MySQL foo-v2.sql=Oracle > diff.sql.

How do I generate schemas required for foo-v1.sql and foo-v2.sql?

What do you mean ? schema are something you write (or someone gives you)

If you have an existing database and you can connect to it with sqlt as documented :)

the short docs

DBI Parser Options: sqlt -f|--from|--parser MySQL -t|--to|--producer Oracle [options] file [file2 ...] --dsn DSN for connecting to database (see also --use-same-auth below) --db-user Database user --db-password Database password

Which you can use like

$ sqlt -f DBI-SQLite --db-user "" --db-password "" --dsn dbi:SQLite:te +mp.sqlite -t SQLite -- -- Created by SQL::Translator::Producer::SQLite -- Created on Thu Oct 2 16:00:34 2014 -- BEGIN TRANSACTION; -- -- Table: "trains" -- CREATE TABLE "trains" ( "A" text NOT NULL, "B" text NOT NULL, "C" real NOT NULL, "D" text NOT NULL, "E" text NOT NULL, "F" real NOT NULL, "G" real NOT NULL ); COMMIT; $ sqlt -f DBI-SQLite --db-user "" --db-password "" --dsn dbi:SQLite:db +idbd.anydata.tsv.temp.sqlite -t Oracle -- -- Created by SQL::Translator::Producer::Oracle -- Created on Thu Oct 2 16:02:17 2014 -- -- -- Table: trains --; CREATE TABLE "trains" ( "A" clob NOT NULL, "B" clob NOT NULL, "C" real NOT NULL, "D" clob NOT NULL, "E" clob NOT NULL, "F" real NOT NULL, "G" real NOT NULL ); /

The long better docs https://metacpan.org/pod/distribution/SQL-Translator/lib/SQL/Translator/Manual.pod#EXTRACT-SQL-SCHEMAS-DIRECTLY-FROM-DATABASE

$ sqlt -f DBI --dsn dbi:mysql:FOO --db-user guest \ --db-password p4ssw0rd -t PostgreSQL > foo

This usage is waaay easier :)

$ sqlt -f DBI --db-user "" --db-password "" --dsn dbi:SQLite:dbidbd.an +ydata.tsv.temp.sqlite -t Oracle -- -- Created by SQL::Translator::Producer::Oracle -- Created on Thu Oct 2 16:07:59 2014 -- -- -- Table: trains --; CREATE TABLE "trains" ( "A" clob NOT NULL, "B" clob NOT NULL, "C" real NOT NULL, "D" clob NOT NULL, "E" clob NOT NULL, "F" real NOT NULL, "G" real NOT NULL ); / $ sqlt -f DBI --db-user "" --db-password "" --dsn dbi:SQLite:dbidbd.an +ydata.tsv.temp.sqlite -t Sybase -- -- Created by SQL::Translator::Producer::Sybase -- Created on Thu Oct 2 16:08:02 2014 -- -- -- Table: trains -- CREATE TABLE trains ( A varchar(255) NOT NULL, B varchar(255) NOT NULL, C double precision NOT NULL, D varchar(255) NOT NULL, E varchar(255) NOT NULL, F double precision NOT NULL, G double precision NOT NULL ); $ sqlt -f DBI --db-user "" --db-password "" --dsn dbi:SQLite:dbidbd.an +ydata.tsv.temp.sqlite -t MySQL -- -- Created by SQL::Translator::Producer::MySQL -- Created on Thu Oct 2 16:08:07 2014 -- SET foreign_key_checks=0; -- -- Table: `trains` -- CREATE TABLE `trains` ( `A` text NOT NULL, `B` text NOT NULL, `C` double NOT NULL, `D` text NOT NULL, `E` text NOT NULL, `F` double NOT NULL, `G` double NOT NULL ); SET foreign_key_checks=1;

In reply to Re: SQL::Translator, sqlt-diff confusion, how to write/generate source schemas by Anonymous Monk
in thread SQL::Translator, sqlt-diff confusion by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.