Browse Source

每月4日备份表,新增备份custom_persist_target表

李莎 1 year ago
parent
commit
28aba908bc
1 changed files with 4 additions and 4 deletions
  1. 4 4
      main.py

+ 4 - 4
main.py

@@ -29,15 +29,16 @@ start_date_month = (datetime.datetime.now() + dateutil.relativedelta.relativedel
 end_date_month = (datetime.datetime.now() + dateutil.relativedelta.relativedelta(months=-1)).strftime("%Y%m")+"01"
 # print(start_date_month,end_date_month)
 
-# start_date_month = "20220903"
-# end_date_month = "20230201"
+# start_date_month = "20230301"
+# end_date_month = "20230401"
 def job():
     if datetime.date.today().day != 4:
-        print("%s 等待2号执行程序"%datetime_now())
+        print("%s 等待4号执行程序"%datetime_now())
     else:
         # 连接mysql
         MysqlUtil = MysqlUtils(**mysql)
 
+        days = get_day_1(start_date_month, end_date_month)
         for date in days:
             print("%s 开始导入%s的数据"%(datetime_now(),date))
             MysqlUtil.update_two(REPLACE_EQUIP_SQL%(date),DELETE_EQUIP_SQL%(date))
@@ -50,6 +51,5 @@ def job():
 
 schedule.every().day.at("08:30").do(job)
 while True:
-    days = get_day_1(start_date_month, end_date_month)
     schedule.run_pending()
     time.sleep(30)