-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
745 additions
and
271 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[report] | ||
exclude_lines = | ||
# Don't complain if tests don't hit defensive assertion code: | ||
raise NotImplementedError |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,25 +21,30 @@ Features | |
* Exclude data for anonymization depending on regular expressions | ||
* Truncate entire tables for unwanted data | ||
|
||
+----------------+----------------------+-----------------------+----------------------------------+ | ||
| Field | Value | Provider | Output | | ||
+================+======================+=======================+==================================+ | ||
| ``first_name`` | John | ``choice`` | (Bob|Larry|Lisa) | | ||
+----------------+----------------------+-----------------------+----------------------------------+ | ||
| ``title`` | Dr. | ``clear`` | | | ||
+----------------+----------------------+-----------------------+----------------------------------+ | ||
| ``street`` | Irving St | ``faker.street_name`` | Miller Station | | ||
+----------------+----------------------+-----------------------+----------------------------------+ | ||
| ``password`` | dsf82hFxcM | ``mask`` | XXXXXXXXXX | | ||
+----------------+----------------------+-----------------------+----------------------------------+ | ||
| ``email`` | [email protected] | ``md5`` | 0cba00ca3da1b283a57287bcceb17e35 | | ||
+----------------+----------------------+-----------------------+----------------------------------+ | ||
| ``email`` | [email protected] | ``faker.unique.email``| [email protected] | | ||
+----------------+----------------------+-----------------------+----------------------------------+ | ||
| ``ip`` | 157.50.1.20 | ``set`` | 127.0.0.1 | | ||
+----------------+----------------------+-----------------------+----------------------------------+ | ||
+----------------+----------------------+------------------------+----------------------------------+ | ||
| Field | Value | Provider | Output | | ||
+================+======================+========================+==================================+ | ||
| ``first_name`` | John | ``choice`` | (Bob|Larry|Lisa) | | ||
+----------------+----------------------+------------------------+----------------------------------+ | ||
| ``title`` | Dr. | ``clear`` | | | ||
+----------------+----------------------+------------------------+----------------------------------+ | ||
| ``street`` | Irving St | ``faker.street_name`` | Miller Station | | ||
+----------------+----------------------+------------------------+----------------------------------+ | ||
| ``password`` | dsf82hFxcM | ``mask`` | XXXXXXXXXX | | ||
+----------------+----------------------+------------------------+----------------------------------+ | ||
| ``email`` | [email protected] | ``md5`` | 0cba00ca3da1b283a57287bcceb17e35 | | ||
+----------------+----------------------+------------------------+----------------------------------+ | ||
| ``email`` | [email protected] | ``faker.unique.email`` | [email protected] | | ||
+----------------+----------------------+------------------------+----------------------------------+ | ||
| ``phone_num`` | 65923473 | ``md5``as_number: True | 3948293448 | | ||
+----------------+----------------------+------------------------+----------------------------------+ | ||
| ``ip`` | 157.50.1.20 | ``set`` | 127.0.0.1 | | ||
+----------------+----------------------+------------------------+----------------------------------+ | ||
| ``uuid_col`` | 00010203-0405-...... | ``uuid4`` | f7c1bd87-4d.... | | ||
+----------------+----------------------+------------------------+----------------------------------+ | ||
|
||
Note: `faker.unique.[provider]` only supported on python3.5+ (Faker library min supported python version) | ||
Note: `uuid4` - only for (native `uuid4<https://www.postgresql.org/docs/current/datatype-uuid.html>`) columns | ||
|
||
See the `documentation`_ for a more detailed description of the provided anonymization methods. | ||
|
||
|
@@ -75,11 +80,13 @@ Usage | |
--dry-run Don't commit changes made on the database | ||
--dump-file DUMP_FILE | ||
Create a database dump file with the given name | ||
--init-sql INIT_SQL SQL to run before starting anonymization | ||
|
||
Despite the database connection values, you will have to define a YAML schema file, that includes | ||
all anonymization rules for that database. Take a look at the `schema documentation`_ or the | ||
`YAML sample schema`_. | ||
|
||
|
||
Example call:: | ||
|
||
$ pganonymize --schema=myschema.yml \ | ||
|
@@ -89,6 +96,14 @@ Example call:: | |
--host=db.host.example.com \ | ||
-v | ||
|
||
$ pganonymize --schema=myschema.yml \ | ||
--dbname=test_database \ | ||
--user=username \ | ||
--password=mysecret \ | ||
--host=db.host.example.com \ | ||
--init-sql "set search_path to non_public_search_path; set work_mem to '1GB';" \ | ||
-v | ||
|
||
Database dump | ||
~~~~~~~~~~~~~ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.