Hi Aryk, An option that works well for us is to use Dataset#multi_insert <http://sequel.jeremyevans.net/rdoc/classes/Sequel/Dataset.html#method-i-multi_insert>. It might work for your case as well.
This allows for a single INSERT statement (as opposed to 1 per row/model) with no SELECT afterward. Depending on your database you might have a limit on query string length or number of rows insertable via an *INSERT ... VALUES ...* statement. The call can be configured to break up the values into batches. This will wrap them all in a transaction, as well. We've also found it's also easy to wrap this call in a transaction if it's part of a larger process. Anyway, I just thought this sounded like it might work for your case. Cheers, Patrick Kuykendall On Thursday, July 27, 2017 at 4:24:04 PM UTC-4, Aryk Grosz wrote: > > Well, we can go back-and-forth, but my logic comes back to two things: > > 1. You generally want the select to happen when inserting so you can read > back default values (which is probably why its a default functionality). > 2. On bulk inserts when you don't want 1000+ select statements pointlessly > happening because you know in this particular instance you aren't reading > back default values, you want to opt-out of this. > > So, we can say anecdotally that "nobody asked for it" or that "it's useful > to many people as it is". > > Ultimately the question is, does this functionality logically belong with > this plugin? I say "yes", you say "no". So we disagree, it happens. > > I'll just roll my own... :) > > Aryk > > On Thursday, July 27, 2017 at 7:11:46 AM UTC-7, Jeremy Evans wrote: >> >> On Wednesday, July 26, 2017 at 10:32:55 PM UTC-7, Aryk Grosz wrote: >>> >>> Yeah, the implementation is super simple because you are basically >>> skipping a method. I think though if you are already going to have a >>> plugin, you may as well give a little functionality to actually make it >>> useful. >>> >> >> The plugin is actually useful now for many users, even if it doesn't >> handle your particular use case directly. >> >> >>> It seems likely someone would want this general functionality on bulk >>> inserts, and opt-in specifically when that happens. This plugin was created >>> and designed for instances like those, but because of the rigid >>> implementation, can't really use it selectively. >>> >> >> It's been 7 years since the plugin was added and this is the first >> request for such a feature. So you may want to reconsider how likely it is >> someone would want this. >> >> >>> Wouldn't take much to throw in an instance accessor. >>> >> >> "Wouldn't take much..." can be used to justify just about any additional >> feature/scope creep. >> >> >>> I can PR it if you want, but if you think it shouldn't belong with this >>> plugin, I'll just do it locally... >>> >> >> If other Sequel users express the need for the feature, then I can >> reconsider. But before adding support for a feature and committing to >> supporting it for a long time, I need to be convinced there is a general >> need for it. >> >> Thanks, >> Jeremy >> > -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to sequel-talk+unsubscr...@googlegroups.com. To post to this group, send email to sequel-talk@googlegroups.com. Visit this group at https://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.