forked from TonicAI/condenser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsubset_result_norm.py
More file actions
26 lines (17 loc) · 822 Bytes
/
subset_result_norm.py
File metadata and controls
26 lines (17 loc) · 822 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from config_reader import ConfigReader
import database_helper
class SubsetResultNorm:
def __init__(self, source_dbc, destination_dbc, schema):
self.source_db = source_dbc
self.destination_db = destination_dbc
self.schema = schema
def norm(self):
desired_result = ConfigReader().get_desired_result()
table = desired_result['table']
percent = desired_result['percent']
with self.source_db.get_db_connection() as conn:
original_count = database_helper.get_table_count(table, self.schema, conn)
with self.destination_db.get_db_connection() as conn:
new_count = database_helper.get_table_count(table, self.schema, conn)
current_percent = 100 * (new_count / original_count)
return percent - current_percent