data_stat_daily.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. dw_channel_daily_total(ymd)
  20. except Exception as e:
  21. DingTalkUtils.send("数据ETL出错:",'18860455786')
  22. def run_order_history():
  23. """当order表跑了历史的数据,要从这历史数据的最早时间跑此任务流"""
  24. for i in du.getDateLists('2019-11-12',du.get_n_days(0)):
  25. print(i)
  26. ods_order(i)
  27. order_sync_ck(i)
  28. dw_channel_daily_total(i)
  29. dw_daily_channel()
  30. print('ok')
  31. def run_cost_history():
  32. "cost 重跑后,跑此任务流"
  33. for i in du.getDateLists('2019-03-18',du.get_n_days(0)):
  34. print(i)
  35. dw_daily_channel_cost(i)
  36. dw_order_channel_cost_sync_ck(i)
  37. dw_channel_daily_total(i)
  38. dw_daily_channel()
  39. def main():
  40. run(yestoday)
  41. dw_daily_channel()
  42. dm_pitcher_daily_page_total()
  43. if __name__ == '__main__':
  44. main()