Пример #1
0
    def tabulate(self):
        #tabulate
        row_counts = list()
        for table in ConfigReader().get_all_tables():
            with self.source_db.get_db_connection() as conn:
                o = database_helper.get_table_count(table, self.schema, conn)
            with self.destination_db.get_db_connection() as conn:
                n = database_helper.get_table_count(table, self.schema, conn)
            row_counts.append((table, o, n))

        print('\n'.join(
            [f'{x[0]}, {x[1]}, {x[2]}, {x[2]/x[1]}' for x in row_counts]))
Пример #2
0
    def norm(self):

        table = config_reader.get_target_table()
        percent = config_reader.get_target_percent()

        with self.source_db.get_db_connection() as conn:
            original_count = database_helper.get_table_count(
                table_name(table), schema_name(table), conn)
        with self.destination_db.get_db_connection() as conn:
            new_count = database_helper.get_table_count(
                table_name(table), schema_name(table), conn)

        current_percent = 100 * (new_count / original_count)

        return percent - current_percent
Пример #3
0
    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
Пример #4
0
def tabulate(source_dbc, destination_dbc, tables):
    #tabulate
    row_counts = list()
    for table in tables:
        with source_dbc.get_db_connection() as conn:
            o = database_helper.get_table_count(table_name(table),
                                                schema_name(table), conn)
        with destination_dbc.get_db_connection() as conn:
            n = database_helper.get_table_count(table_name(table),
                                                schema_name(table), conn)
        row_counts.append((table, o, n))

    print('\n'.join([
        f'{x[0]}, {x[1]}, {x[2]}, {x[2]/x[1] if x[1] > 0 else 0}'
        for x in row_counts
    ]))
Пример #5
0
    def __get_passthrough_tables(self, order):
        passthrough_tables = ConfigReader().get_passthrough_tables()
        passthrough_threshold = ConfigReader().get_passthrough_threshold()

        for o in order:
            for t in o:
                c = database_helper.get_table_count(t, self.schema,
                                                    self.__source_conn)
                if c <= passthrough_threshold:
                    passthrough_tables.append(t)
        #an explicitly marked passthrough table canhave under 100 rows in which case it'll appear in final list twice
        return list(set(passthrough_tables))