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>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
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>
Comment (by Adam Johnson):
Thanks for submitting the ticket Mohit. I'll let someone else (probably a
fellow) comment if it's worth accepting.
--
Ticket URL: <https://code.djangoproject.com/ticket/33427#comment:2>
Comment (by Carlton Gibson):
Hi Mohit.
I'm going to say wontfix here initially: I'm not sure there's much benefit
in complicating `loaddata`; the thought is to create your own command if
you need this, which is just what you've done — nice working sharing that.
It may be that a post to the DevelopersMailingList or
[https://forum.djangoproject.com Forum] would show more demand in which
case we could re-open…
Thanks.
--
Ticket URL: <https://code.djangoproject.com/ticket/33427#comment:3>
* status: new => closed
* resolution: => wontfix
--
Ticket URL: <https://code.djangoproject.com/ticket/33427#comment:4>