def __init__(self): className = self.__class__.__name__ LogUtil.initLogBatch(className) SysUtil.global_init() self.engine = SysUtil.get_engine_handle() self.db = SysUtil.get_db_handle() self.logger = logging.getLogger('batchLog_' + className)
# -*- coding: utf-8 -*- """ Created on Thu Dec 8 16:54:06 2016 @author: Administrator """ import datetime from workserver.util import SysUtil from workserver.module.models import AccountRunningBatch, MatchDataBatch, MatchInfo SysUtil.global_init() engine = SysUtil.get_engine_handle() db = SysUtil.get_db_handle() session = db() def dateRange(start,end): begin = datetime.datetime.strptime(start,"%Y-%m-%d") end = datetime.datetime.strptime(end,"%Y-%m-%d") d = begin delta = datetime.timedelta(days=1) dateList = [] while d <= end: dateList.append(d.strftime("%Y-%m-%d")) d += delta return dateList def clearData(): try: session.query(MatchDataBatch).delete()