[Dbix-class] Re: Using DBIx::Class to copy data between different RDBMS

Eden Cardim edencardim at gmail.com
Thu Dec 3 08:06:09 GMT 2009

>>>>> "Phillip" == Phillip Moore <w.phillip.moore at gmail.com> writes:

    Phillip> Now I recall why I thought get_columns might not work: if I understand
    Phillip> the docs correctly, get_columns() only returns key/value
    Phillip> pairs for the CACHED columns form the database.

That's correct, you can tell the resultset not to fetch certain columns
by passing in a specific column list via the 'select' resultset
attribute, but why would you do that if this is a solution written
specifically to replicate all the values.
    Phillip> If I get a row, and dbic only gets me a subset of the available
    Phillip> columns, is there an easy way to force dbic to get them
    Phillip> ALL?


This will (sort of) guarantee that the resultset fetches all the
columns. The only thing that could break this is if you've defined
->resultset_attributes in your source.

    Phillip> With Class::DBI, I dealt with this by defining all the
    Phillip> columns as part of the Essential column group, but column
    Phillip> groups are a feature that appear to be missing from
    Phillip> DBIx::Class.  I used them very heavily, and had to roll my
    Phillip> own mechanism for grouping them.  Wasn't rocket science....

DBIC doesn't have that "feature" because it's superceeded by the cloning
that happends every time you run ->search, if you need a resultset with
a specific set of columns, have a method build a resultset with the
relevant columns declared via the 'select' attribute and it'll propagate
to all the other resultsets you build from that. If you need to add
additional columns, use '+select' instead.

    Phillip> Do I need to force a query of every possible column for
    Phillip> each row, to ensure that lazy population doesn't result in
    Phillip> missing data in my SQLite copy of the data?

If you don't mess with 'select' in evil ways, you're good.

   Eden Cardim       Need help with your Catalyst or DBIx::Class project?
  Code Monkey                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://edenc.vox.com/            http://www.shadowcat.co.uk/servers/

More information about the DBIx-Class mailing list