data_stat_daily.py 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. from model.DateUtils import DateUtils
  2. from data_stat_task import *
  3. from sync_to_ck_task import *
  4. du = DateUtils()
  5. from model.DingTalkUtils import DingTalkUtils
  6. yestoday = du.get_n_days(-1)
  7. today = du.get_n_days(0)
  8. def run(ymd):
  9. try:
  10. # 公众号元数据
  11. channel_by_account_daily(ymd)
  12. channel_info_daily(ymd)
  13. # 清洗订单表-同步到ck
  14. ods_order(ymd)
  15. order_sync_ck(ymd)
  16. # 公众号维度数据-同步到ck
  17. dw_daily_channel_cost(ymd)
  18. dw_order_channel_cost_sync_ck(ymd)
  19. except Exception as e:
  20. DingTalkUtils.send("数据ETL出错:",'18860455786')
  21. def run_order_history():
  22. """当order表跑了历史的数据,要从这历史数据的最早时间跑此任务流"""
  23. for i in du.getDateLists('2019-11-12',du.get_n_days(0)):
  24. print(i)
  25. ods_order(i)
  26. order_sync_ck(i)
  27. dw_daily_channel()
  28. print('ok')
  29. def run_cost_history():
  30. "cost 重跑后,跑此任务流"
  31. for i in du.getDateLists('2019-03-18',du.get_n_days(0)):
  32. print(i)
  33. dw_daily_channel_cost(i)
  34. dw_order_channel_cost_sync_ck(i)
  35. dw_daily_channel()
  36. def main():
  37. run(yestoday)
  38. dw_daily_channel()
  39. dm_pitcher_daily_page_total()
  40. if __name__ == '__main__':
  41. main()