Opened 13 months ago

Last modified 4 months 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: dev
Severity: Normal Keywords: bulk insert update upsert
Cc: Tom Forbes, Chih Sean Hsu, Adam Johnson Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


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 (8)

comment:1 Changed 13 months ago by Mariusz Felisiak

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 13 months ago by Chih Sean Hsu

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

comment:3 Changed 12 months ago by Chih Sean Hsu

I have opened PR It is still on going.

comment:4 Changed 12 months ago by Chih Sean Hsu

Has patch: set
Needs documentation: set
Needs tests: set

comment:5 Changed 8 months ago by Chih Sean Hsu

Needs documentation: unset
Needs tests: unset

comment:6 Changed 8 months ago by Chih Sean Hsu

It's done and waiting for review.

comment:7 Changed 8 months ago by Alexandr Tatarinov

Added a comment to pull request about potential room for improvement.

comment:8 Changed 4 months ago by Adam Johnson

Cc: Adam Johnson added
Note: See TracTickets for help on using tickets.
Back to Top