Phrogz wrote: > The part that (I think) is making it painfully slow for large data > sets is that Dataset#<< does not always return the primary key of the > record inserted. So I have this code: > mapping = @transformation.call( ...rowdata... ) > # mapping is a hash of field symbols to data > self << mapping > new_row = self.first( mapping ) > @pk_after_transload[ orig_pk ] = new_row.pk > > Is there a better Sequel, DB-agnostic way to be sure about the new > primary key values?
Sequel adapters are supposed to return the new primary key value upon insert, but not all do. I'll accept patches for any that don't. It's especially hard to use those adapters with models, since they generally raise errors on model creation. > Anyhow, in case anyone is interested, here's the code in two files. > The first file shows how I'm using it to specify transloading of data > for a simple site, and the second file is the library itself in its > current form. Do you have plans on packing this into a gem for others to use? Even just a bare repository on github would probably be helpful. Jeremy --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sequel-talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sequel-talk?hl=en -~----------~----~----~----~------~----~------~--~---
