#28668: Add support for ON CONFLICT to bulk_create
-------------------------------------+-------------------------------------
     Reporter:  Tom                  |                    Owner:  nobody
         Type:  New feature          |                   Status:  new
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Description changed by Tom:

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.

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 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.

--

-- 
Ticket URL: <https://code.djangoproject.com/ticket/28668#comment:1>
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/061.98bd48667a58efb6303ee86f74ccf8f8%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to