|
@@ -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)
|