#19527: bulk_create() can set the primary key ----------------------------------------------+-------------------- Reporter: Tuttle | Owner: nobody Type: New feature | Status: new Component: Database layer (models, ORM) | Version: 1.4 Severity: Normal | Keywords: Triage Stage: Unreviewed | Has patch: 0 Easy pickings: 0 | UI/UX: 0 ----------------------------------------------+-------------------- (Sorry if I missed a pre-existing ticket for this.)
There is an IMO big caveat of bulk_create(): It does not set primary key of objects it creates. In my current project, using bulk_create would improve performance, but as I often need an id of the newly created objects, I have to save them one by one. I think it would be perfect if bulk_create starts to set the primary keys of the objects in the given sequence. At least postgresql supports it ("RETURNING id" clause gives us a set of id's). -- Ticket URL: <https://code.djangoproject.com/ticket/19527> 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 https://groups.google.com/groups/opt_out.