Don't ask to ask, just ask | |
PerlMonks |
Re: Db table to non-alike db table copyingby g0n (Priest) |
on Feb 06, 2006 at 08:37 UTC ( [id://528172]=note: print w/replies, xml ) | Need Help?? |
Alternatively, at risk of pimping my own module, Data::Sync is designed to do this sort of operation. Here's an example:
That would: read from $sourcedbihandle all records that match the query Remap the source field names to the target field names Transform the data in field1 with the regex, and field2 lowercase Write all records that have changed since the last run. Deletion isn't supported in v0.06 (on CPAN), but the next version has deletion support; I'm currently trying to up the test coverage, but if you want to /msg me I can send you an early copy. Update: Just to clarify - writing only records that have changed since the last run is based on hashing a list of attributes. The 'hashattributes' parameter to target() contains a list of the attributes you want to hash.
--------------------------------------------------------------
"If there is such a phenomenon as absolute evil, it consists in treating another human being as a thing."
In Section
Seekers of Perl Wisdom
|
|