Opened 2 months ago

Last modified 6 weeks ago

#31685 assigned New feature

Support updating conflicts with QuerySet.bulk_create().

Reported by: Vitor Pereira Owned by: Chih Sean Hsu
Component: Database layer (models, ORM) Version: master
Severity: Normal Keywords: bulk insert update upsert
Cc: Tom Forbes, Chih Sean Hsu Triage Stage: Accepted
Has patch: yes Needs documentation: yes
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

It would be useful having a parameter in bulk_create(), like bulk_create(objs, upsert=True) or bulk_create(objs, update_conflicts=True), that lets you update existing rows when there's a conflict, much like what you can already do for a single entity with update_or_create().

Change History (4)

comment:1 Changed 2 months ago by felixxm

Cc: Tom Forbes added
Summary: Add `update_or_create()` in bulkSupport updating conflicts with QuerySet.bulk_create().
Triage Stage: UnreviewedAccepted

Agreed, it would be great to support updating conflicts with bulk_create():

comment:2 Changed 2 months ago by Chih Sean Hsu

Cc: Chih Sean Hsu added
Owner: changed from nobody to Chih Sean Hsu
Status: newassigned

comment:3 Changed 2 months ago by Chih Sean Hsu

I have opened PR https://github.com/django/django/pull/13065. It is still on going.

comment:4 Changed 6 weeks ago by Chih Sean Hsu

Has patch: set
Needs documentation: set
Needs tests: set
Note: See TracTickets for help on using tickets.
Back to Top