import datetime import pandas as pd from task import common_function as cf filepath = 'parameter.env' # 数据来源,数据库配置信息 fbg_source_hostname = cf.MySearch(filepath, 'mysql_fbg_bsc_hostname') fbg_source_port = int(cf.MySearch(filepath, 'mysql_fbg_bsc_port')) fbg_source_username = cf.MySearch(filepath, 'mysql_fbg_bsc_username') fbg_source_password = cf.MySearch(filepath, 'mysql_fbg_bsc_password') # 数据中间仓库,数据库配置信息 fbg_mid_hostname = cf.MySearch(filepath, 'mysql_fbg_mid_hostname') fbg_mid_port = int(cf.MySearch(filepath, 'mysql_fbg_mid_port')) fbg_mid_username = cf.MySearch(filepath, 'mysql_fbg_mid_username') fbg_mid_password = cf.MySearch(filepath, 'mysql_fbg_mid_password') # 源数据库 连接 engine_source = ("mysql+pymysql://%s:%s@%s:%d/?charset=utf8" % (fbg_source_username, fbg_source_password, fbg_source_hostname, fbg_source_port)) # 目标数据库 dstDb = 'fbg_mid_dw' dstTb = 't_bsc_check_tremonth_flow' # 构建目标数据库连接字典 conn_dest = dict() conn_dest["host"] = fbg_mid_hostname conn_dest["port"] = fbg_mid_port conn_dest["user"] = fbg_mid_username
#!/usr/bin/python3 # -*- coding:utf-8 -*- import pandas as pd import datetime from task import common_function as cf filepath = 'parameter.env' # 数据中间仓库,数据库配置信息 fbg_mid_hostname = cf.MySearch(filepath, 'mysql_fbg_mid_hostname') fbg_mid_port = int(cf.MySearch(filepath, 'mysql_fbg_mid_port')) fbg_mid_username = cf.MySearch(filepath, 'mysql_fbg_mid_username') fbg_mid_password = cf.MySearch(filepath, 'mysql_fbg_mid_password') # 目标数据库 dbdest = 'fbg_mid_dw' dstable = 't_ret_order_status_track_sum_tmp' # 构建目标数据库连接字典 conn_dest = dict() conn_dest["host"] = fbg_mid_hostname conn_dest["port"] = fbg_mid_port conn_dest["user"] = fbg_mid_username conn_dest["passwd"] = fbg_mid_password conn_dest["db"] = dbdest conn_dest["charset"] = "utf8" engine_dest = ("mysql+pymysql://%s:%s@%s:%d/%s?charset=utf8" % (fbg_mid_username, fbg_mid_password, fbg_mid_hostname, fbg_mid_port, dbdest)) # 首先判断当前执行时间 确定需要统计的仓库
import pandas as pd from task import common_function as cf filepath = 'parameter.env' # 数据来源,数据库配置信息 wms_source_hostname = cf.MySearch(filepath, 'mysql_fbg_wms_hostname') wms_source_port = int(cf.MySearch(filepath, 'mysql_fbg_wms_port')) wms_source_username = cf.MySearch(filepath, 'mysql_fbg_wms_username') wms_source_password = cf.MySearch(filepath, 'mysql_fbg_wms_password') wmsDb = 'wms_goodcang_com' engine_wms = ("mysql+pymysql://%s:%s@%s:%d/%s?charset=utf8" % (wms_source_username, wms_source_password, wms_source_hostname, wms_source_port, wmsDb)) # 数据来源,数据库配置信息 ods_source_hostname = cf.MySearch(filepath, 'mysql_fbg_ods_hostname') ods_source_port = int(cf.MySearch(filepath, 'mysql_fbg_ods_port')) ods_source_username = cf.MySearch(filepath, 'mysql_fbg_ods_username') ods_source_password = cf.MySearch(filepath, 'mysql_fbg_ods_password') odsDb = 'gc_ods' engine_ods = ("mysql+pymysql://%s:%s@%s:%d/%s?charset=utf8" % (ods_source_username, ods_source_password, ods_source_hostname, ods_source_port, odsDb)) # 目标数据库配置信息 fbg_mid_hostname = cf.MySearch(filepath, 'mysql_fbg_mid_hostname') fbg_mid_port = int(cf.MySearch(filepath, 'mysql_fbg_mid_port')) fbg_mid_username = cf.MySearch(filepath, 'mysql_fbg_mid_username') fbg_mid_password = cf.MySearch(filepath, 'mysql_fbg_mid_password') dstDb = 'fbg_mid_dw' dstTb = 't_ods_fba_orders' # 构建目标数据库连接字典