renyupeng 1 년 전
부모
커밋
0e2e9f64a6
2개의 변경된 파일49개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      Apietl/kwai_etl/report/MateirialVideoDailyReport.py
  2. 47 0
      Apietl/task/signature_photo_Id.py

+ 2 - 2
Apietl/kwai_etl/report/MateirialVideoDailyReport.py

@@ -280,8 +280,8 @@ select report.advertiser_id
        cma.shot_leader_id,
        cma.shot_leader_name
 from media_api.kuaishou_material_video_report_daily report
-         left join media_api.kuaishou_video_list video
-                    on report.advertiser_id = video.account_id and report.photo_id = video.photo_id
+         left join media_api.signature_photo_id video
+                    on report.photo_id = video.photo_id
          left join (select  code,material_name from `jeecg-boot`.ctop_material_info where status=1) cmi on video.signature = cmi.code
          left join `jeecg-boot`.ctop_material_ascription cma on cma.material_id = video.signature
          left join `jeecg-boot`.ctop_user_allocation cua on cua.account_id = report.advertiser_id

+ 47 - 0
Apietl/task/signature_photo_Id.py

@@ -0,0 +1,47 @@
+# Author renyupeng
+# coding=utf-8
+# @Time    : 2021/9/27 10:50 上午
+# @Site    :
+# @File    : MaterialCost.py
+# @Software: PyCharm
+# @contact: renyupeng@c-top.com.cn
+# @Tel 1501435553
+import logging
+from math import ceil
+from Apietl.utlis.Utils import Utils
+from Apietl.conn.TidbConn import TidbConn
+
+
+class signature_photo_Id:
+    def __init__(self):
+        self.conn = TidbConn.get_connection()
+        self.parm = Utils.get_args()
+
+    def daily_report(self):
+        try:
+
+            sql = """
+        replace into media_api.signature_photo_id
+    select signature,photo_id,photo_name,channel_type
+    from                      media_api.kuaishou_video_list
+    where signature is not null and photo_id is not null and stat_date>=date_format(date_sub(now(),interval 6 day),'%Y%m%d')
+    group by signature,photo_id
+    """
+            print(sql)
+            TidbConn.upsert(conn=self.conn, sql_buff=sql)
+            self.conn.commit()
+            TidbConn.conn_close(conn=self.conn)
+            return 0
+        except Exception as e:
+            logging.error(e)
+            return -1
+
+
+if __name__ == '__main__':
+    status = signature_photo_Id().daily_report()
+    if status == 0:
+        print("作业执行成功")
+        exit(0)
+    else:
+        print("作业执行失败")
+        exit(-1)