Getting the schema for a DB table
Simon Wistow
simon at thegestalt.org
Mon May 26 18:08:32 BST 2014
On Sun, May 25, 2014 at 08:11:20PM +0100, Ash Berlin said:
> `sqlt` from SQL::Translator can also give this ISTR http://search.cpan.org/~frew/SQL-Translator-0.11018/script/sqlt:
Ahah! That looks great
my $translator = SQL::Translator->new(
no_comments => 1,
parser => 'DBI',
parser_args => { dbh => $dbh },
producer => "SQLite",
producer_args => { no_transaction => 1 },
filters => [ sub { my $s = shift;
$s->drop_table($_)
for grep { $_ ne $table } $s->get_tables }
],
);
my $spec = eval { $translator->translate };
Although that filter looks ugly so I may have missed an option
somewhere.
Cheers
More information about the london.pm
mailing list