Opened 7 years ago

Last modified 5 years ago

#28668 closed New feature

Add support for ON CONFLICT to bulk_create — at Initial Version

Reported by: Tom Forbes Owned by: nobody
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords:
Cc: Дилян Палаузов Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When using bulk_create it would be nice to support ON CONFLICT DO NOTHING, which allows existing rows to be included in the bulk_create call, e.g:

Comment.objects.create(name='test', text='test')
Comment.objects.bulk_create(Comment(name='test', text='test'), on_conflict=IGNORE)  # Does not throw an exception

All the databases we support have syntax for this, as well as updating/replacing fields.

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top