from config.config import elastic_configs #Web = 'ga:164962980' #MobileWeb = 'ga:164937152' #App = 'ga:98444990' DB_NAME = 'DB_Marketing' TABLE_NAME = 'GA_DailyUsersByPeriod' # INDX = 'ga_carousel_perf' # DO NOT CHANGE IT !!! BATCH_SIZE = 100000 # Database Connection try: cnxn = db_engine.init_engine() cursor = cnxn.cursor() except Exception as e: print(str(e)) view_id = sys.argv[1] app_type = 'Web' if view_id == 'ga:164962980' else 'App' if view_id == 'ga:98444990' else 'MobileWeb' today_date = datetime.datetime.now().date() def main(): try: analytics = ga_engine.initialize_analyticsreporting('web') except Exception as e: exec_sp = "EXEC [DB_DBA].[log].[Usp_Insert_ErrorLog] 'daily_users_data' , 'bimarketing' , '{}' , '{}' , NULL , NULL , NULL , 'Python' ,NULL , '[email protected];[email protected]' , '09384149786' , 0 , 0 ".format(
TABLE_NAME = 'GA_RawData_DS_V2' INDX = 'ga_rawdata_digistyle' # DO NOT CHANGE IT !!! BATCH_SIZE = 100000 es = es_engine.init_engine(elastic_configs['ES_ADDRESS']) doc = logger.create_log('ES Connection', 'Ack', hostname=socket.gethostname(), text="Successful Connect to ES!") es_engine.log_into_es(es, 'textlogs-{}'.format(INDX), doc) # Database Connection try: cnxn = db_engine.init_engine(DB_NAME) cursor = cnxn.cursor() doc = logger.create_log('DB Connection', 'Ack', hostname=socket.gethostname(), text="Successful Connect to DB!") es_engine.log_into_es(es, 'textlogs-{}'.format(INDX), doc) except Exception as e: doc = logger.create_log('DB Connection', 'Nack', hostname=socket.gethostname(), text=str(e)) es_engine.log_into_es(es, 'textlogs-{}'.format(INDX), doc) sys.exit()