Re: Getting the schema for a DB table

2014-05-27 Thread Simon Wistow
On Tue, May 27, 2014 at 08:20:02PM +0200, Thomas Klausner said: > Hi! Wotcha! > Well, we use DBIx::SchemaChecksum in some utility scripts that are > invoked maybe once a day per hand (and quite often less than that). > > So neither process size nor start up time was an issue when writing it.

Re: Getting the schema for a DB table

2014-05-27 Thread Simon Wistow
On Mon, May 26, 2014 at 05:45:26PM +0100, me said: > If you're already using Moose I'm sure it's fantastic but adding ~120 > dependencies (of which ~30 are core admittedly) for something I could > probably write in nearly as many lines of code[*] probably isn't going > to fly unfortunately. Wei

Re: Getting the schema for a DB table

2014-05-27 Thread Tom Hukins
On Tue, May 27, 2014 at 08:20:02PM +0200, Thomas Klausner wrote: > I've never had problems with installing deps since cpanm came out. > > I usually do something like > cpanm --installdeps . -n -L local That's fortunate. In recent months I've encountered problems taking this approach with a cl

Re: Getting the schema for a DB table

2014-05-27 Thread Thomas Klausner
Hi! On Tue, May 27, 2014 at 06:33:16PM +0100, Simon Wistow wrote: > On Tue, May 27, 2014 at 02:42:21PM +0100, Sam Kington said: > > What's wrong with dependencies? It just takes a few minutes to > > install, disc is cheap, and it's not like any of the rest of your code > > is going to magically

Re: Getting the schema for a DB table

2014-05-27 Thread Simon Wistow
On Tue, May 27, 2014 at 02:42:21PM +0100, Sam Kington said: > What's wrong with dependencies? It just takes a few minutes to > install, disc is cheap, and it's not like any of the rest of your code > is going to magically start loading these new modules and being all > bloaty and insecure or wha

Re: Getting the schema for a DB table

2014-05-27 Thread Sam Kington
On 26 May 2014, at 17:45, Simon Wistow wrote: > On Sun, May 25, 2014 at 07:38:54PM +0200, Thomas Klausner said: >> If you want a hash of the current DB schema, take a look at >> DBIx::SchemaChecksum >> >> Not sure if this is what you're after, but I hope it helps.. > > It would be perfect ... e

Re: Getting the schema for a DB table

2014-05-26 Thread Simon Wistow
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=

Re: Getting the schema for a DB table

2014-05-26 Thread Simon Wistow
On Sun, May 25, 2014 at 07:38:54PM +0200, Thomas Klausner said: > If you want a hash of the current DB schema, take a look at > DBIx::SchemaChecksum > > Not sure if this is what you're after, but I hope it helps.. It would be perfect ... except for that fact that it uses Moose (and also doesn't

Re: Getting the schema for a DB table

2014-05-25 Thread Ash Berlin
`sqlt` from SQL::Translator can also give this ISTR http://search.cpan.org/~frew/SQL-Translator-0.11018/script/sqlt: sqlt -d -f DBI-PostgreSQL -t PostgreSQL --dsn dbi:Pg:dbname=CMS Might be a bit flakey with some more advanced Pg features - my version is quite out of date though. Thomas' solut

Re: Getting the schema for a DB table

2014-05-25 Thread Thomas Klausner
Hi! On Sun, May 25, 2014 at 05:46:45PM +0100, Simon Wistow wrote: > Alternatively - what I'm really trying to do is get a unique finger > print for the schema of a database. My current plan is hashing the > CREATE TABLE statement but other methods would be gratefully received. If you want a h

Getting the schema for a DB table

2014-05-25 Thread Simon Wistow
[ Continuing the series of "Simon doesn't really do Perl (or programming) that much anymore and therefore asks dumb questions" ] I'm looking for something that can be pointed at a DB table and can give the schema for the table back - preferably in the form of an SQL CREATE TABLE statement but I