Opened 5 years ago

Last modified 2 months ago

#30138 new Cleanup/optimization

Allow QuerySet.bulk_create() to set pk of created objects when ignore_conflicts=True — at Version 1

Reported by: saber solooki Owned by: nobody
Component: Database layer (models, ORM) Version: 2.2
Severity: Normal Keywords:
Cc: Alex Vandiver, Ülgen Sarıkavak Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description (last modified by Tim Graham)

As requested in ticket:28668#comment:24, here's a ticket for setting the primary keys of created objects. I tried it in PostgreSQL 10.6 and this could be supported. When ignore_confilicts=True, Django doesn't put ' RETURNING "mymodel"."id" ' in the query.

Change History (1)

comment:1 by Tim Graham, 5 years ago

Description: modified (diff)
Summary: Return pk of created objects when ignore_conflicts set True on QuerySet.bulk_create()Allow QuerySet.bulk_create() to set pk of created objects when ignore_conflicts=True
Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/optimization
Note: See TracTickets for help on using tickets.
Back to Top