Skip to main content

A Django data dump script generator

Project description

This is a Django data dump script generator. It either generates a script to call dumpdata or does dumpddata itself.

It may produce command line scripts usable within a Makefile or as a simple bash scripts to dump or load data with Django from the many app names you give it.

It need a dependancies map to know what is required to be dumped.

Maps

Currently it only have two maps one for “djangocms-2” and one for “djangocms-3” projects, and so it only knows about:

  • Django contrib auth;

  • Django sites;

  • emencia.django.countries;

  • contact_form;

  • DjangoCMS and its common plugins;

  • Zinnia;

  • Porticus;

  • South;

  • django-tagging;

  • django-taggit;

  • easy-thumbnails;

  • django-filer;

  • django-google-tools;

  • emencia-django-socialaggregator;

  • emencia-django-slideshows;

Note : Many app depends on Django’s content types but we don’t bother because it is automatically filled by Django and we should never try to dump/load it.

Format

  • Dumps order does matter to respect module’s dependancies;

  • model or dependancy names can be string or either a list of names, take care that string is splitted on white spaces, if you use excude flag like ‘-e’ with your model names, always use a list;

  • Circular dependancies is possible;

Sample map :

[
    ('DUMP_NAME_KEY', {
        'use_natural_key': true,
        'models': 'mymodel',
        'exclude_models': 'my_excluded_model',
        'dependancies': [],
    }),
]

Where :

DUMP_NAME_KEY

Is the dump entry name, can be anything but commonly this is the app package name, this is what is used in embedded map files.

use_natural_key

A boolean to define if the dump can use natural key, if not defined, a dump entry is assumed to support natural key.

models

Is either a string of the model name or a list model names. Django accept either an app name from which it will take all its models, or a specific app model.

exclude_models

Is either a string of the model name or a list model names. It will exclude all those models from the dumpdata command.

dependancies

Either a string of another dump names to depends of. They will be taken also even if they haven’t been explicitely requested from user.

Codec

DrDump will use a dump codec to tranform the list of dump instructions (models or apps to dump, excluded models, usage of natural keys) into actions: actual call of management commands or script generation.

Loading data

DrDump will generate a manifest file with the list of the fixtures it has generated.

DrDump can automate the process of loading the data it has generated. The Python module drdump.load can load the manifest:

python -m drdump.load <manifest file>

The management command dr_load does the same thing:

manage.py dr_load <manifest>

Django

DrDump provides a management command to launch the dump or generate the dump commands:

manage.py dr_dump ...

It will take command line arguments that defaults to settings.

DRDUMP_MAP_FILE

The path to the map file

DRDUMP_OTHER_APPS

A boolean that decides if all unlisted apps are also dumped

DRDUMP_EXCLUDE_APPS

A list of applications or models to exclude from the dump

DRDUMP_OPTIONS

The options of the dump codec

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dr-dump-1.1.5.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

dr_dump-1.1.5-py2.py3-none-any.whl (13.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file dr-dump-1.1.5.tar.gz.

File metadata

  • Download URL: dr-dump-1.1.5.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5

File hashes

Hashes for dr-dump-1.1.5.tar.gz
Algorithm Hash digest
SHA256 03fa27fdbbb841f20b2f672572ef42a85a25997a2b7a37857ca3b13831cbed58
MD5 fcb36912204c0b798d1b1ebdc9d2cc31
BLAKE2b-256 62cd94c17b1fb5d6df2aad9b4a80a89d284a09b58e21fbaf90c7f24fe24bc224

See more details on using hashes here.

File details

Details for the file dr_dump-1.1.5-py2.py3-none-any.whl.

File metadata

  • Download URL: dr_dump-1.1.5-py2.py3-none-any.whl
  • Upload date:
  • Size: 13.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5

File hashes

Hashes for dr_dump-1.1.5-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 dc3a4e48713cb9ec0db66bc270eb2c1e4282c14f404695156124e452c6ef4341
MD5 2c3df586389f3c2a8c16b94c7d1b4d56
BLAKE2b-256 eb6dcc9d9cff410aaea3e6d88795388903d8a2c9e573d06b2e498fe3c45f7f66

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page