예제 #1
0
from util.topic import Topic
from util.schema import Schema
from util.connector import JDBCSource as JDBCSourceConnector, Datagen as DatagenConnector
from util.ksql_api import Api as KSQLApi

load_dotenv(dotenv_path='./.env')

if sys.argv[1] in ['db', 'all']:
    historical_database = Database(
        **{
            'data_name': 'historical',
            'seed_path': join(getenv('DIR_DATA'), getenv(
                'FILE_DATA_HISTORICAL')),
        })
    historical_database.delete()
    historical_database.create()

if sys.argv[1] in ['hc', 'c', 'all']:
    historical_data_connector = JDBCSourceConnector(
        **{
            'host': getenv('CONNECT_HOST'),
            'data_name': 'historical',
            'poll_interval': int(getenv('HISTORICAL_POLL_INTERVAL')),
            'keyfield': getenv('HISTORICAL_KEYFIELD'),
            'query': getenv('HISTORICAL_QUERY'),
            'control_center_host': getenv('CONTROL_CENTER_HOST'),
        })
    historical_data_connector.delete()
    historical_data_connector.create()

if sys.argv[1] in ['rc', 'c', 'all']: