#17788: bulk_create() "too many SQL variables" error
-------------------------------------+-------------------------------------
     Reporter:  alpar                |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:
  (models, ORM)                      |  1.4-beta-1
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by akaariai):

 I also thought about that. I think the better approach would say that
 every backend has a 1000 parameter limit. That way if you are inserting
 2-column rows (m2m tables for example), you could insert 499 items in one
 query. If they were 20 column items, then you would get to insert 49 and
 so on.

 I think 20 objects per call is a little low anyhow.

 And the above is a bit theoretical anyways, as that change can't be done
 now.

 I think the best approach is to set a 1000 parameter limit for SQLite, no
 limit for others, and give a way to define the batch size by a kwarg. I
 will ask pgsql-general if they have some suggestions about this. I know
 doing a WHERE id IN large_list isn't efficient, but I don't know if this
 is true for inserts.

 I don't think there is any possibility to get the above into 1.4. There is
 just too little time to fine-tune all the details (transaction handling
 etc). In addition the above is a new feature. Correct me if I am wrong, I
 would love to have a more reliable bulk_insert available.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/17788#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to