Skip to main content

An anonymization tool for production databases

Project description

pynonymizer

pynonymizer is a tool for translating sensitive production database dumps into anonymized copies.

This anonymized data can be used in development and testing.

Supported Databases

  1. mysql

Requirements

mysql

  • mysql
  • mysqldump
  • database connection (to restore, anonymize, and dump from)
  • access to mysqldump file (single file)

Process

  1. Restore database from dumpfile
  2. anonymize database with appropriate strategy
  3. dump resulting data to file
  4. clean up!

Getting Started

Usage

  1. Set required env (normally, or using dotenv)
  2. Write a strategyfile for your database
  3. Run command pynonymizer
usage: pynonymizer [-h] [--db-name DB_NAME] [-v] input strategyfile output

A tool for writing better anonymization strategies for your production databases.

environment variables:
  DB_TYPE      Type of database (mysql)
  DB_HOST      Database host/ip (127.0.0.1)
  DB_USER      Database username
  DB_PASS      Database password
  FAKE_LOCALE  Locale to initialize faker generation (en_GB)

positional arguments:
  input                 The source dumpfile to read from.

                        [.sql, .gz]
  strategyfile          A strategyfile to use during anonymization.
  output                The destination to write the dumped output to.
                        [.sql, .gz]

optional arguments:
  -h, --help            show this help message and exit
  --db-name DB_NAME, -n DB_NAME
                        Name of database to create in the target host and restore to. This will default to a random name.
  -v, --version         show program's version number and exit

Development

  1. setup venv
  2. install dependencies with pip install -r requirements.txt

Testing

  1. run tox

License

MIT

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

pynonymizer-1.1.2.tar.gz (10.7 kB view hashes)

Uploaded Source

Built Distribution

pynonymizer-1.1.2-py3-none-any.whl (16.8 kB view hashes)

Uploaded Python 3

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