[Dbix-class] Dump table to disk

Jonathan Yu jonathan.i.yu at gmail.com
Wed Mar 4 14:42:25 GMT 2009


Hi:

Given that you feed DBIC a copy of your Schema - so that it knows
where all your tables, columns, etc are - then SQL::Translator will
have an idea of all the tables involved. So it should be trivial to do
SELECTs on each of these tables, but the problem with a general
solution that DBIC/SQLT would provide is that it would run a lot of
huge SELECT queries to dump SQL out.

It's probably much faster to use the builtin operations, though less
portable. Perhaps an area for later work is a module that does this
sort of thing; if not dumping, then some sort of other way of
extracting the data for backup purposes or what-have-you.

I'll look into it further (perhaps a solution already exists, but
nobody else seems to have chimed in yet); if there is nothing else
then I'll see what I can hack together using SQL::Abstract and
DBIx::Class.

Cheers,

Jonathan

On Wed, Mar 4, 2009 at 9:28 AM, Dermot <paikkos at googlemail.com> wrote:
> 2009/3/4 Jonathan Yu <jonathan.i.yu at gmail.com>:
>> Hi there:
>>
>> You can dump the Schema object into SQL, but I'm not sure if it also
>> dumps the appropriate INSERTs... Look in SQL::Translator, that's where
>> you're most likely to find something like that (SQLT is the backend
>> that does some of the nitty-gritty on behalf of DBIC)
>>
>> Storable seems like a hackish way to do things. Personally I would
>> suggest you dump SQL.
>>
>
> Thanx Jonathan. I did it the hackish way. I was a single table so the
> structure was easy to store. This was for an SQLite3 db which doesn't
> have a dump function quite yet. It does have a realitvely new backup
> function (http://www.sqlite.org/backup.html).
> Cheers,
> Dp.
>
> _______________________________________________
> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk
>



More information about the DBIx-Class mailing list