{ "info": { "author": "", "author_email": "", "bugtrack_url": null, "classifiers": [], "description": "# Database sanitation tool\n\n[![pypi][pypi-image]][pypi-url]\n[![travis][travis-image]][travis-url]\n[![codecov][codecov-image]][codecov-url]\n\n[pypi-image]: https://badge.fury.io/py/database-sanitizer.svg\n[pypi-url]: https://pypi.org/project/database-sanitizer/\n[travis-image]: https://travis-ci.org/andersinno/python-database-sanitizer.svg?branch=master\n[travis-url]: https://travis-ci.org/andersinno/python-database-sanitizer\n[codecov-image]: https://codecov.io/gh/andersinno/python-database-sanitizer/branch/master/graph/badge.svg\n[codecov-url]: https://codecov.io/gh/andersinno/python-database-sanitizer\n\n`database-sanitizer` is a tool which retrieves an database dump from\nrelational database and performs sanitation on the retrieved data\naccording to rules defined in a configuration file. Currently the\nsanitation tool supports both [PostgreSQL] and [MySQL] databases.\n\n[PostgreSQL]: https://postgres.org\n[MySQL]: https://mysql.com\n\n## Installation\n\n`database-sanitizer` can be installed from [PyPI] with [pip] like this:\n\n```bash\n$ pip install database-sanitizer\n```\n\nIf you are using MySQL, you need to install the package like this\ninstead, so that additional requirements are included:\n\n```bash\n$ pip install database-sanitizer[MySQL]\n```\n\n[PyPI]: https://pypi.org\n[pip]: https://pip.pypa.io/en/stable/\n\n## Usage\n\nOnce the package has been installed, `database-sanitizer` can be used\nlike this:\n\n```bash\n$ database-sanitizer \n```\n\nCommand line argument `DATABASE-URL` needs to be provided so the tool\nknows how to retrieve the dump from the database. With PostgreSQL, it\nwould be something like this:\n\n```bash\n$ database-sanitizer postgres://user:password@host/database\n```\n\nHowever, unless an configuration file is provided, no sanitation will be\nperformed on the retrieved database dump, which leads us to the next\nsection which will be...\n\n## Configuration\n\nRules for the sanitation can be given in a configuration file written in\n[YAML]. Path to the configuration file is then given to the command line\nutility with `--config` argument (`-c` for shorthand) like this:\n\n[YAML]: http://yaml.org\n\n```bash\n$ database-sanitizer -c config.yml postgres://user:password@host/database\n```\n\nThe configuration file uses following kind of syntax:\n\n```YAML\nconfig:\n addons:\n - some.other.package\n - yet.another.package\n extra_parameters: # These parameters will be passed to the dump tool CLI\n mysqldump:\n - \"--single-transaction\" # Included by default\n pg_dump:\n - \"--exclude-table=something\"\nstrategy:\n user:\n first_name: name.first_name\n last_name: name.last_name\n secret_key: string.empty\n access_log: skip_rows\n```\n\nIn the example configuration above, there are first listed two \"addon\npackages\", which are names of Python packages where the sanitizer will\nbe looking for sanitizer functions. They are completely optional and can\nbe omitted, in which case only sanitizer functions defined in package\ncalled `sanitizers` and built-in sanitizers will be used instead.\n\nIt's also possible to define extra parameters to pass to the dump tool (\n`mysqldump` or `pg_dump`). By default, `mysqldump` will include the\n`--single-transaction` extra parameter. You can disable this by defining the\nextra parameters in the config file explicitly, e.g. with an empty array `[]`.\n\nThe `strategy` portion of the configuration contains the actual\nsanitation rules. First you define name of the database table (in the\nexample that would be `user`) followed by column names in that table\nwhich each one mapped to sanitation function name. The name of the\nsanitation function consists from two parts separated from each other by\na dot: Python module name and name of the actual function, which will\nbe prefixed with `sanitize_`, so `name.first_name` would be a function\ncalled `sanitize_first_name` in a file called `name.py`.\n\nTable content can be left out completely from the sanitized dump by\nsetting table strategy to `skip_rows` (check `access_log` table in the\nexample config). This will leave out all `INSERT INTO` (MySQL) or `COPY`\n(PostgreSQL) statements from the sanitized dump file. `CREATE TABLE`\nstatements will not be removed.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/andersinno/python-database-sanitizer", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "database-sanitizer", "package_url": "https://pypi.org/project/database-sanitizer/", "platform": "", "project_url": "https://pypi.org/project/database-sanitizer/", "project_urls": { "Homepage": "https://github.com/andersinno/python-database-sanitizer" }, "release_url": "https://pypi.org/project/database-sanitizer/1.1.0/", "requires_dist": [ "PyYAML (>=3.12)", "six (>=1.11.0)", "PyMySQL ; extra == 'mysql'" ], "requires_python": "", "summary": "Sanitizes contents of a database.", "version": "1.1.0" }, "last_serial": 5512053, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "14c022fbfb2050ed44f39571fb4034e3", "sha256": "f77f1687ebe5fc58b558c25f64cc0d5e522cc87de293876f243dd6c21a176bdb" }, "downloads": -1, "filename": "database_sanitizer-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "14c022fbfb2050ed44f39571fb4034e3", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 12063, "upload_time": "2018-05-07T10:08:25", "url": "https://files.pythonhosted.org/packages/80/f4/8a55371cb2e3b81866b7ed7f726a8f6528b97e4c34bd12cc6a9c4d1cc043/database_sanitizer-0.1.0-py2.py3-none-any.whl" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "f4a440e0ec448f879d701cb6c180b16d", "sha256": "7e6a5def7b6de58ffc0361d5f25ac0ddb56a08ea080da6e0ca6d23192f92b94f" }, "downloads": -1, "filename": "database_sanitizer-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f4a440e0ec448f879d701cb6c180b16d", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 17078, "upload_time": "2018-05-16T11:05:50", "url": "https://files.pythonhosted.org/packages/d6/5f/b48b670075ab3d657483b92f058293111eac254dbc3f9671f54ae17f64b2/database_sanitizer-0.2.0-py2.py3-none-any.whl" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "394b18a7d9fac0127628a171220eda77", "sha256": "1486ea9416831b6733dcbbd36a4b40886b9d537e25cd1977421453618f17b7e0" }, "downloads": -1, "filename": "database_sanitizer-0.3.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "394b18a7d9fac0127628a171220eda77", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 23834, "upload_time": "2018-05-29T11:59:24", "url": "https://files.pythonhosted.org/packages/bb/e9/9be5b1a861429081d4bafa3f017f550ff9d545c8f3338e070cd4e6ca5f72/database_sanitizer-0.3.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e5b801d8797eb899ddc3fbdf9649d52e", "sha256": "2347243cef51f3a60908b10527638c3b1c8265eedfe4cbc3fb7a1d37223e1357" }, "downloads": -1, "filename": "database-sanitizer-0.3.0.tar.gz", "has_sig": false, "md5_digest": "e5b801d8797eb899ddc3fbdf9649d52e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17616, "upload_time": "2018-05-29T11:59:25", "url": "https://files.pythonhosted.org/packages/cb/00/10d0e6fcb2ce1ea1b726958ac9dd59bd799b0f0bd2d0efbbdd1c1bd10364/database-sanitizer-0.3.0.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "f5d52a8dbb0db6cbcf26e299b14f0a8f", "sha256": "5c3327531de37694d4ee927c82119e78b1c6456bca5a46aec06eda29ef5ad62c" }, "downloads": -1, "filename": "database_sanitizer-0.4.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f5d52a8dbb0db6cbcf26e299b14f0a8f", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 23845, "upload_time": "2018-06-20T07:07:51", "url": "https://files.pythonhosted.org/packages/82/3b/909164bba6800a480fdada71e5c2e13e757672ddc7fdadaf5940b7b21021/database_sanitizer-0.4.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9a935be6023d3977b050151832c82332", "sha256": "2760faaad1b965a9237dac8adb9f95110a5301b104bd4057979f4eca104b7b2a" }, "downloads": -1, "filename": "database-sanitizer-0.4.0.tar.gz", "has_sig": false, "md5_digest": "9a935be6023d3977b050151832c82332", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17634, "upload_time": "2018-06-20T07:07:52", "url": "https://files.pythonhosted.org/packages/16/b3/817e5cb0665c08bf396b6486b200a89522249add55317609ee602200e70b/database-sanitizer-0.4.0.tar.gz" } ], "0.4.1": [ { "comment_text": "", "digests": { "md5": "6591a9769de362810c9906f2731039fb", "sha256": "7a405f2a6c17c8151ddde3768dec98c15f3cef1ccd17337639544b3fd6ca0281" }, "downloads": -1, "filename": "database_sanitizer-0.4.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "6591a9769de362810c9906f2731039fb", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 23866, "upload_time": "2019-05-15T10:21:20", "url": "https://files.pythonhosted.org/packages/7c/d5/04bc3ce1627a1f56bafff14886f789b5b0bac109dc7c54fb30e505d43caa/database_sanitizer-0.4.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2a43c4c7d3baefb7e632331d190c5c5c", "sha256": "7b22ebed60fe8823768ed52b399e100036e9a452676a1403960b4c0c59a69b5d" }, "downloads": -1, "filename": "database-sanitizer-0.4.1.tar.gz", "has_sig": false, "md5_digest": "2a43c4c7d3baefb7e632331d190c5c5c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19224, "upload_time": "2019-05-15T10:21:22", "url": "https://files.pythonhosted.org/packages/f6/9b/230982d08f697f4628ef562f690b676199497a7b5c2444e395eb22b4a0a3/database-sanitizer-0.4.1.tar.gz" } ], "0.4.2": [ { "comment_text": "", "digests": { "md5": "28d778004d30df79cb60b4b99fd9d535", "sha256": "fe5a859a357bc5fe564f069f33f1db7c72124a1c1c3e56ed5d49dc22bba10ad3" }, "downloads": -1, "filename": "database_sanitizer-0.4.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "28d778004d30df79cb60b4b99fd9d535", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 23790, "upload_time": "2019-05-15T12:31:32", "url": "https://files.pythonhosted.org/packages/fb/dc/53bf913b71df900ab4c4a6c39ea46d18facf3a1b32d9d6c42d5406d11c90/database_sanitizer-0.4.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e5f8af7974c56a9c1d66cdba3905dadc", "sha256": "e80c224991fa161a655d2658e44fd837ed280dce9c19c7ac57daa52583e114db" }, "downloads": -1, "filename": "database-sanitizer-0.4.2.tar.gz", "has_sig": false, "md5_digest": "e5f8af7974c56a9c1d66cdba3905dadc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19715, "upload_time": "2019-05-15T12:31:34", "url": "https://files.pythonhosted.org/packages/f0/76/f569eec12e002a1016eebab213498d312a494eed0e61fb8c6fadcace86c6/database-sanitizer-0.4.2.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "405419722a26f87ee6d8825f76f65e92", "sha256": "2ae232eb7df9726c36adfdbcb199ee7712f9f2567b50ea06bfe49b951d039e93" }, "downloads": -1, "filename": "database_sanitizer-1.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "405419722a26f87ee6d8825f76f65e92", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 24388, "upload_time": "2019-06-07T11:11:51", "url": "https://files.pythonhosted.org/packages/92/58/2d883a38d5006b16272ad45a3d99a6fcab1a24fd63abb4a635eb2d126f86/database_sanitizer-1.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "80980a77013e33aeb2ffebd7850277de", "sha256": "503ca591103210e17d8fb6a74aa0c279b328bfb6cec8af5796c626cb112ed747" }, "downloads": -1, "filename": "database-sanitizer-1.0.0.tar.gz", "has_sig": false, "md5_digest": "80980a77013e33aeb2ffebd7850277de", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20588, "upload_time": "2019-06-07T11:11:52", "url": "https://files.pythonhosted.org/packages/82/dd/3a3bcc93566e629c4c76ded4fd1f599cf93d8d960c9fc23b2dd9d0fc340e/database-sanitizer-1.0.0.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "abd6abff677d9f48929fa386121b89e7", "sha256": "f717ed4e9f64b193f580d0d744c96ec2f95c0e853b69b5bccdb85e5807e9bbca" }, "downloads": -1, "filename": "database_sanitizer-1.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "abd6abff677d9f48929fa386121b89e7", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 24762, "upload_time": "2019-07-10T13:11:12", "url": "https://files.pythonhosted.org/packages/e0/46/463838e59da24ff5f82e846ca176bd8c805d46869e3e51e5c0da6152ceca/database_sanitizer-1.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b8d52c338400a8b538baafd7854a2863", "sha256": "14d93f6eefcb08a4a96d5a075ba6e5a5e3e3ac2b8c57374114b6be889b5ea97a" }, "downloads": -1, "filename": "database-sanitizer-1.1.0.tar.gz", "has_sig": false, "md5_digest": "b8d52c338400a8b538baafd7854a2863", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19424, "upload_time": "2019-07-10T13:11:14", "url": "https://files.pythonhosted.org/packages/16/b6/60328d604247cabe04f7fe65aed23e7b67b7b7c3738c8e4709fce8a0a65b/database-sanitizer-1.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "abd6abff677d9f48929fa386121b89e7", "sha256": "f717ed4e9f64b193f580d0d744c96ec2f95c0e853b69b5bccdb85e5807e9bbca" }, "downloads": -1, "filename": "database_sanitizer-1.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "abd6abff677d9f48929fa386121b89e7", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 24762, "upload_time": "2019-07-10T13:11:12", "url": "https://files.pythonhosted.org/packages/e0/46/463838e59da24ff5f82e846ca176bd8c805d46869e3e51e5c0da6152ceca/database_sanitizer-1.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b8d52c338400a8b538baafd7854a2863", "sha256": "14d93f6eefcb08a4a96d5a075ba6e5a5e3e3ac2b8c57374114b6be889b5ea97a" }, "downloads": -1, "filename": "database-sanitizer-1.1.0.tar.gz", "has_sig": false, "md5_digest": "b8d52c338400a8b538baafd7854a2863", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19424, "upload_time": "2019-07-10T13:11:14", "url": "https://files.pythonhosted.org/packages/16/b6/60328d604247cabe04f7fe65aed23e7b67b7b7c3738c8e4709fce8a0a65b/database-sanitizer-1.1.0.tar.gz" } ] }