Django command to install the named fixture(s) in the database without overriding existing primary keys.
Project 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) Using djloaddata to install fixture ensures that no existing rows will be touched and all the objects will only be inserted while preserving all the relations between model objects.
Requirements
Python 3.6 to 3.10 supported.
Django 2.2 to 4.0 supported.
Installation
First, install with pip:
python -m pip install dj-snake
Second, add the app to your INSTALLED_APPS setting:
INSTALLED_APPS = [
...,
"dj_snake",
...,
]
The app adds a new management command named djloaddata.
Usage
python manage.py djloaddata fixture [fixture ...]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file dj-snake-1.1.2.tar.gz
.
File metadata
- Download URL: dj-snake-1.1.2.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33ff7c4915b7482f7becfcf32a5b0a6cb5f85c307ecfb935ff6bef62a52fb3c8 |
|
MD5 | 07d385a2bdaafe1d064ea3bff18b8d5d |
|
BLAKE2b-256 | 2865fce3a61bf789ab9eb7b6e93d6027471859a865ea6a54b7a4b76ef67e92d4 |
File details
Details for the file dj_snake-1.1.2-py3-none-any.whl
.
File metadata
- Download URL: dj_snake-1.1.2-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b39db68d45d3beb36624a31ac8d8187189b247b5a27a1df629ee98ae710d0409 |
|
MD5 | 51b4ea4861382d99155fb94c3eac2b6d |
|
BLAKE2b-256 | 0a83b16e6d674f003858507910ab466149df97c2ba91d3abc511f03663993453 |