Re: [Rails-core] ActiveRecord, create Optimization Patch

2006-07-18 Thread zdennis
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Nicholas Seckar wrote: > > I think there are two separate cases: one where you want to insert a > *lot* of records that you know to be valid, and another to insert a > bunch of records that you do not trust to be valid. I 100% agree with this state

Re: [Rails-core] ActiveRecord, create Optimization Patch

2006-07-18 Thread Michael Genereux
I agree with you that there should be an option as to whether to insert any if some fail. I was thinking of an instance where the user gets 500,000 rows of incomplete data and wants to put in anything that conforms to validation. This was a scenario that I specifically experienced. Sometimes

Re: [Rails-core] ActiveRecord, create Optimization Patch

2006-07-18 Thread Nicholas Seckar
On 7/17/06, Michael Genereux <[EMAIL PROTECTED]> wrote: I agree import is appropriate.  However, the reason someone would wantthis in Rails is to integrate a CSV import through the web interface foran end user.  Why would it skip validation though? There are cases where skipping validation is desir

Re: [Rails-core] ActiveRecord, create Optimization Patch

2006-07-17 Thread zdennis
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 James Adam wrote: > On 7/17/06, zdennis <[EMAIL PROTECTED]> wrote: > >> > That said, I think providing an 'import' method as a plugin would >> > certainly be useful to some people (especially those too lazy to >> > connect to a database by hand). >> >

Re: [Rails-core] ActiveRecord, create Optimization Patch

2006-07-17 Thread James Adam
On 7/17/06, zdennis <[EMAIL PROTECTED]> wrote: > That said, I think providing an 'import' method as a plugin would > certainly be useful to some people (especially those too lazy to > connect to a database by hand). I like to automate tasks, if that makes me lazy, then I am lazy. Me too - I mu

Re: [Rails-core] ActiveRecord, create Optimization Patch

2006-07-17 Thread zdennis
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 James Adam wrote: > On 7/17/06, zdennis <[EMAIL PROTECTED]> wrote: > >> AR is so well thought out and designed, this seems >> like a core feature that is just simply missing. > > > Since you are looking for speed to the point where you are sacrifici

Re: [Rails-core] ActiveRecord, create Optimization Patch

2006-07-17 Thread James Adam
On 7/17/06, zdennis <[EMAIL PROTECTED]> wrote: AR is so well thought out and designed, this seems like a core feature that is just simply missing. Since you are looking for speed to the point where you are sacrificing validations, and pretty much anything else vaguely active-record-ish, beyond

Re: [Rails-core] ActiveRecord, create Optimization Patch

2006-07-17 Thread zdennis
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Koziarski wrote: > On 7/17/06, James Adam <[EMAIL PROTECTED]> wrote: > >> Since the behaviour is different from that of create (i.e. no object >> instances are returned), why not just define a new method which >> clearly indicates it's aptitud

Re: [Rails-core] ActiveRecord, create Optimization Patch

2006-07-17 Thread Joshua Sierles
I'm still not convinced that a workaround like this is the right wayto solve these 'bulk load' / ETL scenarios.   Why not use your database's import tools or some really lightweight SQL wrappers?While the  'insert' method is more universal, I agree that it's often smarter to use the vendor tools. F

Re: [Rails-core] ActiveRecord, create Optimization Patch

2006-07-17 Thread Michael Genereux
I agree import is appropriate. However, the reason someone would want this in Rails is to integrate a CSV import through the web interface for an end user. Why would it skip validation though? I would expect: 1. A creation of ActiveRecord objects for all the elements in the hash. 2. Validatio

Re: [Rails-core] ActiveRecord, create Optimization Patch

2006-07-17 Thread Michael Koziarski
On 7/17/06, James Adam <[EMAIL PROTECTED]> wrote: Since the behaviour is different from that of create (i.e. no object instances are returned), why not just define a new method which clearly indicates it's aptitude for inserting large amounts of data? Model.import(hashes) or something... The be

Re: [Rails-core] ActiveRecord, create Optimization Patch

2006-07-17 Thread James Adam
Since the behaviour is different from that of create (i.e. no object instances are returned), why not just define a new method which clearly indicates it's aptitude for inserting large amounts of data? Model.import(hashes) or something... - james On 7/17/06, zdennis <[EMAIL PROTECTED]> wrote: -

Re: [Rails-core] ActiveRecord, create Optimization Patch

2006-07-16 Thread zdennis
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Rick Bradley wrote: > * zdennis ([EMAIL PROTECTED]) [060716 20:33]: > > Not commenting on the viability of the patch as a whole, but perhaps > rather than :fast / :fastest it would be better to drop :fast (which as > I understand it simply reduces th

Re: [Rails-core] ActiveRecord, create Optimization Patch

2006-07-16 Thread zdennis
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Rick Bradley wrote: > * zdennis ([EMAIL PROTECTED]) [060716 20:33]: >> Could someone check this out and give some feedback? I have started to >> develop this as a separate plugin for ActiveRecord, but the more I think >> about it the more it seems that

Re: [Rails-core] ActiveRecord, create Optimization Patch

2006-07-16 Thread Rick Bradley
* zdennis ([EMAIL PROTECTED]) [060716 20:33]: > Could someone check this out and give some feedback? I have started to > develop this as a separate plugin for ActiveRecord, but the more I think > about it the more it seems that this sort of thing should be in core. > Thoughts? Those are impressive

[Rails-core] ActiveRecord, create Optimization Patch

2006-07-16 Thread zdennis
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Attached is a patch with the following API change for ActiveRecord::Base.create. Currently ActiveRecord::Base.create takes either a hash of attributes or an array of hashes of attributes. If you pass in an array it will treat each hash individually an