I'm interested in this as well. Two points to make. One, why not start with 
postgresql, which if I understand correct already supports getting ids in 
bulk_create. I think the "how to support getting ids in MySQL" is a 
separate issue. Second, I strongly agree with Shai, falling back should 
either not happen at all, or need to be requested explicitly (a keyword to 
accept it that defaults to false).

On Wednesday, March 30, 2016 at 5:07:21 PM UTC-6, Shai Berger wrote:
>
> On Tuesday 29 March 2016 13:19:01 Anssi Kääriäinen wrote: 
> > 
> > Personally I think we should just rename the method to fast_create() 
> > and allow it to fall back to single row at time behavior. This way you 
> > could safely call it for any objects on any database and know the 
> > results will be OK. I don't see much point in throwing errors when 
> > batch insert isn't possible. If batch insert isn't possible, the user 
> > needs to insert the values one row at a time in any case. 
> > 
>
> I beg to differ. fast_create() as you described will be suitable for some 
> users, but if creating 2000 records is going to require 2000 database 
> roundtrips, I'd appreciate a way to be told about it already when I'm 
> testing 
> with 2. I could have other options to create the records (perhaps not 
> using 
> the ORM at all), or I could decide early that the backend is unsuitable 
> for my 
> needs. 
>
> For some optimizations, it is OK to just drop them if you can't do them. 
> But 
> with bulk_create we could be talking about differences of orders of 
> magnitude. 
> It seems to me that with that premise, the decision that it's ok to drop 
> the 
> optimization should be explicit, and not Django's default. 
>
> My 2 cents, 
>         Shai. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/8eac26fc-9165-49ba-b044-5298f31354d3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to