#28668: Add ON CONFLICT support to QuerySet.bulk_create()
-------------------------------------+-------------------------------------
Reporter: Tom | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):
* stage: Unreviewed => Accepted
Old 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:
>
> {{{#!python
> 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.
>
> This is a spin-off of https://code.djangoproject.com/ticket/28641, just
> including the ON CONFLICT idea which is backwards-compatible and would be
> easier to implement than the others.
New 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:
{{{#!python
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.
This is a spin-off of #28641, just including the ON CONFLICT idea which is
backwards-compatible and would be easier to implement than the others.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/28668#comment:2>
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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/061.f6bc313a2102d980c2a439dac7ed2db6%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.