#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: Design Has patch: 0 | decision needed Needs tests: 0 | Needs documentation: 0 Easy pickings: 0 | Patch needs improvement: 0 | UI/UX: 0 -------------------------------------+------------------------------------- Changes (by akaariai):
* cc: anssi.kaariainen@… (added) * needs_docs: => 0 * stage: Unreviewed => Design decision needed * needs_tests: => 0 * needs_better_patch: => 0 Comment: Yes, it would be possible. The biggest problem is actually knowing how many parameters the backend happens to support. For most backends the limit isn't variable amount, it is the query string length. Because of this it is impossible to make the bulk_insert immune to all batch size errors. (No, calculating the query string length isn't a sane option). The way forward would be defining a max_variables_per_query for each backend. For sqlite3 it is 1000, for other backends it could be None for no limit. There could also be a kwarg "batch_size" by which you could override the default batch size given by the backend. -- Ticket URL: <https://code.djangoproject.com/ticket/17788#comment:1> 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.