def main(): """The usage is :- python app.py env table_list """ print("The parameters are:", sys.argv) env = sys.argv[1] a_tables = sys.argv[2] logger.add("logs/data-copier.info", rotation="1 KB", retention="10 days", level="INFO") logger.add("logs/data-copier.err", rotation="1 KB", retention="10 days", level="ERROR") db_details = load_db_details(env) print(db_details) logger.debug(db_details) tables = get_tables('table_list', a_tables) print(tables) logger.debug(tables) for table_name in tables['table_name']: logger.info(f'reading data for {table_name}') data, column_names = read_table(db_details, table_name) logger.debug(f'Data is: {data}') logger.debug(f"Column names are:{column_names}") logger.info(f'loading data for {table_name}') load_table(db_details, data, column_names, table_name)
def main(): print("Docker Test") env = sys.argv[1] db_details = load_db_details(env) tables = get_tables('tables_list') for table_name in tables['table_name']: data, column_names = read_table(db_details, table_name) load_table(db_details, data, column_names, table_name)
def main(): """Program takes at least one argument""" env = sys.argv[1] db_details = load_db_details(env) tables = get_tables('table_list') for table_name in tables['table_name']: print(f'reading data for {table_name}') data, column_names = read_table(db_details, table_name) print(f'loading data for {table_name}') load_table(db_details, data, column_names, table_name)
def main(): env = sys.argv[1] a_tables = sys.argv[2] db_details = load_db_details(env) tables = get_tables('table_list', a_tables) for table in tables['table_name']: data, column_names = read_table(db_details, table) #test = build_insert_query(table, column_names) load_table(db_details, data, column_names, table) print(f'Successfully completed process for {table}')
def main(): env = sys.argv[1] db_details = load_db_details(env) print(db_details) tables = get_tables('table_list') db_details = DB_DETAILS[env] for table in tables['table_name']: print(f'Reading data from {table}') data, columns = read_table(db_details, table) print(data) print(f'Loading data into {table}') load_table(db_details, table, columns, data)
def main(): """Program takes at least one argument""" env = sys.argv[1] db_details = load_db_details(env) tables = get_tables('table_list') print("These are the tables to be loaded", tables) for table_name in tables['table_name']: print('Reading data for {}'.format(table_name)) data, column_names = read_table(db_details, table_name) # print(column_names) print('Loading data for {}'.format(table_name)) load_table(db_details, data, column_names, table_name)
def main(): """ this takes atleast one argiument""" env = sys.argv[1] db_details = DB_DETAILS[env] tables = get_tables('table_list') print(tables) for table in tables['table_name']: print(table) data, column_names = read_table(db_details, table, limit=10) print(data) print(column_names) load_table(db_details, data, column_names, table)
def main(): """Program takes at least one arguments""" db_details = load_db_details(env) tables = get_tables(path='src/main/python/table_list.csv', table_list='all') for table in tables['table_name']: table_n = table # reading the data from mysql data, columns = read_table(db_details, DB_USER=DB_USER_MYSQL, DB_PASS=DB_PASS_MYSQL, table_name=table_n) # loading data to postgres load_table(db_details=db_details, DB_USER=DB_USER_POSTGRES, DB_PASS=DB_PASS_POSTGRES, data=data, column_names=columns, table_name=table_n)