DC_TNS_NAME ) if __name__ == "__main__" : """ 为一柜通新增营业部运营参数脚本 """ try: MSG_INFO = {} MSG_INFO["MSG_NO"] = 0 MSG_INFO["MSG_STR"] = "初始消息空间" ''' 获取 任务运行参数 ''' sqlStr = "select * from insbusi_inserneworginfo where insert_org_flag = '0';" xList = mySqlConn.query(sqlStr) if len(xList) == 0: MSG_INFO["MSG_NO"] = 100001 MSG_INFO["MSG_STR"] = "没有要增加的记录,请检查参数表中的处理标志!" raise Exception (MSG_INFO) for init in xList: bSysName = "一柜通_{0}".format(init["org_code"]) # 动态生成任务名称 taskName = "{0}_{1}".format(bSysName, globParaList["YGT_ORACLE_HOST"]) init["task_name"] = taskName # 保留的日志文件
import os import datetime import json import time import schedule import threading from apps.runscripts.Ext_Functions.CommFuncs import C_PrintLog, Get_Param_Info, \ cxOracle, Print_Dict_KandV, Gen_Now_Date, Dict2List os.environ['DJANGO_SETTINGS_MODULE'] = 'YwzcWebSys.settings' from apps.commset.GetSysInfo import mySqlConn strSql = "select param_value from YwzcWebSys.commset_sysparam where param_en_name='CALENDAR_SOURCE'" CParam = mySqlConn.query(strSql) CParam = eval(CParam[0]["param_value"].replace("\r\n", "").replace(" ", "")) print(CParam) # 创建到账户库的链接 TNS_NAME = '(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=%s)(PORT=%s)))(CONNECT_DATA=(SERVICE_NAME=%s)))' % ( CParam["ORACLE_HOST"], CParam["ORACLE_PORT"], CParam["ORACLE_SERVICE_NAME"]) oraConn = cxOracle(CParam["ORACLE_USER_NAME"], CParam["ORACLE_USER_PASSWD"], TNS_NAME) oraStrSql = "SELECT * FROM {0} A".format(CParam["TABLE_NAME"]) rtnDatas = oraConn.QueryDict(oraStrSql)