def doHourUpdate(data): threading.Thread(target=loadDataDatabase(data)) return def doOnceUpdate(data): threading.Thread(target=loadDataDatabase(data)) return def run(data): #dataForDay = data[data.导入频率=='1d']; # dataForWeek = data[data.导入频率=='1w']; # dataForHour = data[data.导入频率=='1h']; dataFor5Min = data[data.导入频率 == '5m'] #schedule.every().day.at("23:56").do(doDayUpdate,dataForDay); # schedule.every().friday.at("05:00").do(doWeekUpdate,dataForWeek); schedule.every(5).minutes.do(doFiveMinuteUpdate, dataFor5Min) # schedule.every().hour.do(doHourUpdate,dataForHour); while True: schedule.run_pending() time.sleep(1) #根据 if __name__ == '__main__': configPath = r"E:\transPass_test\road_topic\LoadDataForRoad3.xlsx" data = createSqlEngin.initInfo(configPath) #loadDataDatabase(data); run(data)
import createSqlEngin import pandas as pd import time data = pd.DataFrame() inputdir = r"D:\transPass_test\loaddata\LoadData3.xlsx" createSqlEngin.initInfo(inputdir) engin = createSqlEngin.enginDict for i in range(1, 100): data['fdate'] = [20190940 + i] * 10 data['name'] = ['tom'] * 10 data['age'] = [10] * 10 keys = list(engin.keys()) tempengin = engin[keys[0]] data.to_sql(name="test1", con=tempengin, if_exists="append", index=False) print("完成") time.sleep(60)