result = func_base(upper_limit_guess)

    return (lower_limit_guess, last_result, min(upper_limit_guess,
                                                100), result)


if __name__ == '__main__':
    config_reader.initialize()

    source_dbc = DbConnect(config_reader.get_source_db_connection_info())
    destination_dbc = DbConnect(
        config_reader.get_destination_db_connection_info())
    temp_schema = 'subset_' + str(uuid.uuid4()).replace('-', '')

    # Get list of tables to operate on
    all_tables = list_all_tables(source_dbc.get_db_connection())
    all_tables = [
        x for x in all_tables if x not in config_reader.get_excluded_tables()
    ]

    lower_limit, lower_limit_norm, upper_limit, upper_limit_norm = compute_fast_limits(
    )
    max_tries = config_reader.get_max_tries()

    try:
        bisect(func,
               lower_limit,
               upper_limit,
               maxiter=max_tries,
               args=(lower_limit, lower_limit_norm, upper_limit,
                     upper_limit_norm))
Beispiel #2
0
    database.create()

    # Get list of tables to operate on
    db_helper = database_helper.get_specific_helper()
    all_tables = db_helper.list_all_tables(source_dbc)
    all_tables = [
        x for x in all_tables if x not in config_reader.get_excluded_tables()
    ]

    subsetter = Subset(source_dbc, destination_dbc, all_tables)

    try:
        subsetter.prep_temp_dbs()
        subsetter.run_middle_out()

        if "--no-constraints" not in sys.argv:
            database.add_constraints()

        print("Beginning post subset SQL calls")
        start_time = time.time()
        for idx, sql in enumerate(config_reader.get_post_subset_sql()):
            print_progress(sql, idx + 1,
                           len(config_reader.get_post_subset_sql()))
            db_helper.run_query(sql, destination_dbc.get_db_connection())
        print("Completed post subset SQL calls in {}s".format(time.time() -
                                                              start_time))

        result_tabulator.tabulate(source_dbc, destination_dbc, all_tables)
    finally:
        subsetter.unprep_temp_dbs()