コード例 #1
0
import sys
sys.path.insert(0, './')

import configparser
import psycopg2
import pandas as pd
from sql_queries import *
import time
from create_tables import main
from etl import etl_main
from infra_control import createCluster, checkCluster, deleteCluster

if __name__ == "__main__":

    print('Checking if cluster exists. If not, then create it.')
    if checkCluster() == -1:
        createCluster()

    while checkCluster() == -2:
        time.sleep(5)
        print('Waiting for cluster to be ready ...', end='\r')

    print('Cluster ready, getting endpoint.')
    end_point = checkCluster()

    print('\n\nAll good, commencing ETL.')
    main(create_table_queries, drop_table_queries)
    etl_main(copy_table_queries, insert_table_queries)
コード例 #2
0
from create_tables import main as create_tables_main
from etl import main as etl_main


##############################################################################
if __name__ == '__main__':
    create_tables_main()
    print("Tables created successfully")
    etl_main()
    print("data inserted successfully")