Giter Site home page Giter Site logo

dj_anonymizer's Introduction

dj_anonymizer Build Status codecov.io PyPI version

dj_anonymizer is a utility designed to anonymize production databases with various types of mock data, specifically designed for use within Django projects.

Project works with Django 4.2 or higher and Python 3.8 or higher.

Documentation

https://dj-anonymizer.readthedocs.io/en/latest/

dj_anonymizer's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dj_anonymizer's Issues

Check model_fields list before start anonymization process

Need to add the check for comparing specified_fields and model_fields before start execution anonymization cause anonymization process can raise an exception in the middle of it in case of different list of existing and specified fields

Handle cases when table does not exist in database

If dump is made not from latest database snapshot there is a possibility that a table exists in code but does not exist in the database.
Now in such cases anonymization execution fails
Think it can be mitigated with an additional flag for anonymizer and/or warning during execution

ProtectedError on clean step if model is referenced throught a protected Foreign key

In cases like

class Musician(models.Model):
    instrument = models.CharField(max_length=100)

class Album(models.Model):
    artist = models.ForeignKey(
        'app.Musician',
        on_delete=models.PROTECT
    )

Order matters for cleaning models

For example

from dj_anonymizer import register_models

register_models.register_clean([
    Musician, Album
])

Will raise

django.db.models.deletion.ProtectedError: ("Cannot delete some instances of model 'Musician' because they are referenced through a protected foreign key: ...

And in case

from dj_anonymizer import register_models

register_models.register_clean([
    Album, Musician
])

All will be good

Add new anonym_field - password field

For anonymized DB will be great to have same password for all users
It will help easilly login via any user by knowing username/password

now we suport two type of fileds:

  • anonym_field.function
  • anonym_field.string

and it's possible to do via anonym_field.function
but easier way is to support anonym_field.password out the box

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.