#28668: Add ON CONFLICT support to QuerySet.bulk_create()
     Reporter:  Tom Forbes           |                    Owner:  Tom
                                     |  Forbes
         Type:  New feature          |                   Status:  assigned
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0

Comment (by Дилян Палаузов):

 How essential is it, that objects inserted in the database, have their
 {{{._state.adding}}} and {{{._state.db}}} set?  The code from
 {{{bulk_create(..., on_conflict='ignore')}}} below is not called when
 ids=[], which happens when database does not return the IDs.

                 for obj_without_pk, pk in zip(objs_without_pk, ids):
                     obj_without_pk.pk = pk
                     obj_without_pk._state.adding = False
                     obj_without_pk._state.db = self.db


Ticket URL: <https://code.djangoproject.com/ticket/28668#comment:14>
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 
For more options, visit https://groups.google.com/d/optout.

Reply via email to