-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDataCleaner.py
33 lines (25 loc) · 886 Bytes
/
DataCleaner.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import argparse
from DBInterface import DBInterface
class DataCleaner(DBInterface):
"""
The DataCleaner helps sanitize data for publishing in Stage.
It does this by anonymizing user data
"""
def anonymize_user_data(self):
query = """
UPDATE users
SET
email = 'user_' || id || '@example.com',
api_key = 'REDACTED',
password_digest = 'REDACTED'
"""
self._execute_query(query)
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Sanitize data for publishing in Stage"
)
parser.add_argument("--admin_db_conn_string", type=str, help="Admin database connection string")
args = parser.parse_args()
admin_db_conn_string = args.admin_db_conn_string
data_cleaner = DataCleaner(admin_db_conn_string)
data_cleaner.anonymize_user_data()