|
@@ -10,6 +10,8 @@ REPLACE_EQUIP_SQL = "replace into sagacloud_review.custom_project_equipment_quar
|
|
|
REPLACE_SPACE_SQL = "replace into sagacloud_review.custom_space_quarter_history SELECT * from sagacloud_review.custom_space_quarter where date = '%s'"
|
|
|
DELETE_EQUIP_SQL = "delete from sagacloud_review.custom_project_equipment_quarter where date = '%s'"
|
|
|
DELETE_SPACE_SQL = "delete from sagacloud_review.custom_space_quarter where date = '%s'"
|
|
|
+REPLACE_TARGET_SQL = "replace into sagacloud_customization.custom_persist_target_history SELECT * from sagacloud_customization.custom_persist_target where date = '%s'"
|
|
|
+DELETE_TARGET_SQL = "delete from sagacloud_customization.custom_persist_target where date = '%s'"
|
|
|
|
|
|
|
|
|
def datetime_now():
|
|
@@ -31,7 +33,7 @@ end_date_month = (datetime.datetime.now() + dateutil.relativedelta.relativedelta
|
|
|
# end_date_month = "20230201"
|
|
|
def job():
|
|
|
if datetime.date.today().day != 2:
|
|
|
- print("%s 等待1号执行程序"%datetime_now())
|
|
|
+ print("%s 等待2号执行程序"%datetime_now())
|
|
|
else:
|
|
|
# 连接mysql
|
|
|
MysqlUtil = MysqlUtils(**mysql)
|
|
@@ -40,6 +42,7 @@ def job():
|
|
|
print("%s 开始导入%s的数据"%(datetime_now(),date))
|
|
|
MysqlUtil.update_two(REPLACE_EQUIP_SQL%(date),DELETE_EQUIP_SQL%(date))
|
|
|
MysqlUtil.update_two(REPLACE_SPACE_SQL%(date),DELETE_SPACE_SQL%(date))
|
|
|
+ MysqlUtil.update_two(REPLACE_TARGET_SQL%(date),DELETE_TARGET_SQL%(date))
|
|
|
|
|
|
# 关闭数据库
|
|
|
MysqlUtil.close()
|