Skip to main content

Utilities for deduping Django model instances

Project description

Build status codecov Python version

A collection of classes and utilities to aid in de-duping Django model instances.

Requirements

  • Python 3.6

  • Django 1.11

Install

pip install django-super-deduper

Usage

Merging Duplicate Instances

By default any empty values on the primary object will take the value from the duplicates. Additionally, any related one-to-one, one-to-many, and many-to-many related objects will be updated to reference the primary object.

> from django_super_deduper.merge import MergedModelInstance
> primary_object = Model.objects.create(attr_A=None, attr_B='')
> alias_object_1 = Model.objects.create(attr_A=X)
> alias_object_2 = Model.objects.create(attr_B=Y)
> merged_object = MergedModelInstance.create(primary_object, [alias_object_1, alias_object_2])
> merged_object.attr_A
X
> merged_object.attr_B
Y

Improvements

  • Support multiple merging strategies

  • Recursive merging of related one-to-one objects

Logging

This package does have some rudimentary logging for debugging purposes. Add this snippet to your Django logging settings to enable it:

LOGGING = {
    'loggers': {
        'django_super_deduper': {
            'handlers': ['console'],
            'level': 'DEBUG',
        },
    },
}

References

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

django-super-deduper-0.1.4.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

django_super_deduper-0.1.4-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file django-super-deduper-0.1.4.tar.gz.

File metadata

  • Download URL: django-super-deduper-0.1.4.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.0

File hashes

Hashes for django-super-deduper-0.1.4.tar.gz
Algorithm Hash digest
SHA256 e88cd3f954d44feef6c06d44267a17f289cc65f42eb802b44091ec7e50e5f36c
MD5 92d4f6ad8a4f903aea6423006d465889
BLAKE2b-256 9a94b943a991c8348fc7a9d0f7894a8cab7087a477d4651a7e02c7dd099b1fa9

See more details on using hashes here.

File details

Details for the file django_super_deduper-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: django_super_deduper-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.0

File hashes

Hashes for django_super_deduper-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 d7e0b971e917ef4ac28a1f40e5bf3c0eb66f4d09ca04c079654333e6da0e3008
MD5 972d0b2794a5289217bfc6d5a53cf363
BLAKE2b-256 c82a9a10418648cb439acc6c9677579e7753ff5f70cb9cb831dfa5c56f42c643

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