#33427: Add new flag in loaddata command that loads fixture without overriding
existing objects with same primary key
-------------------------------------+-------------------------------------
     Reporter:  Mohit Solanki        |                    Owner:  nobody
         Type:  New feature          |                   Status:  new
    Component:  Core (Management     |                  Version:  dev
  commands)                          |
     Severity:  Normal               |               Resolution:
     Keywords:  loaddata, fixture,   |             Triage Stage:
  command                            |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Description changed by Mohit Solanki:

Old description:

> Installing fixtures with django's `loaddata` command overrides objects
> with the same primary key.
> While this is not a problem if you are installing the fixtures against a
> fresh DB with no data but in case you have
> existing data then loading the fixture can be problematic as all the
> existing rows with the same primary key will be updated
> with the new data from the fixture(s)
> It would be a good idea to have an additional flag that for e.g
> `--insert-only` or something that tells django not to override existing
> objects with the same primary key.
>
> Note: I created this package https://github.com/mohi7solanki/dj-snake to
> solve this issue but I think It would be a good idea to add this
> functionality to `loaddata` itself

New description:

 Installing fixtures with django's `loaddata` command overrides objects
 with the same primary key.
 While this is not a problem if you are installing the fixtures against a
 fresh DB with no data but in case you have
 existing data then loading the fixture can be problematic as all the
 existing rows with the same primary key will be updated
 with the new data from the fixture(s)
 It would be a good idea to have an additional flag like for e.g `--insert-
 only` or something that tells django not to override existing objects with
 the same primary key.

 Note: I created this package https://github.com/mohi7solanki/dj-snake to
 solve this issue but I think It would be a good idea to add this
 functionality to `loaddata` itself

--

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33427#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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/070.8a6993da50cc5b1e48b3a0a1a885e3ea%40djangoproject.com.

Reply via email to