|
@@ -11,6 +11,8 @@ from math import ceil
|
|
|
|
|
|
import pandas as pd
|
|
|
from sqlalchemy import create_engine
|
|
|
+
|
|
|
+from Apietl.utlis.Logger import Logger
|
|
|
from Apietl.utlis.Utils import Utils
|
|
|
from TidbConn import TidbConn
|
|
|
|
|
@@ -28,7 +30,7 @@ class UnitHourlyReport:
|
|
|
stat_date between {start_time} and {end_time}""".format(
|
|
|
start_time=self.start_time, end_time=self.end_time)
|
|
|
totalNum = TidbConn.quary(sql)[0][0]
|
|
|
- pageCount = ceil(totalNum / 3000)
|
|
|
+ pageCount = ceil(totalNum / 20000)
|
|
|
for i in range(pageCount):
|
|
|
sql = """replace into application.kuaishou_unit_report_hourly_dw
|
|
|
(account_id, stat_date,`hour`, campaign_id, campaign_name, unit_id, unit_name, project_id, product_id, advertiser_id,
|
|
@@ -209,8 +211,8 @@ class UnitHourlyReport:
|
|
|
left join
|
|
|
`jeecg-boot`.ctop_account_attribution_info sys
|
|
|
on report.advertiser_id = sys.account_id
|
|
|
- where report.stat_date between {start_time} and {end_time} order by unit_id,hour,stat_date limit {num},3000""".\
|
|
|
- format(start_time=self.start_time, end_time=self.end_time,num=i * 3000)
|
|
|
+ where report.stat_date between {start_time} and {end_time} order by unit_id,hour,stat_date limit {num},20000""".\
|
|
|
+ format(start_time=self.start_time, end_time=self.end_time,num=i * 20000)
|
|
|
TidbConn.exec_sql(self.conn, sql)
|
|
|
self.conn.commit()
|
|
|
return 0
|
|
@@ -221,7 +223,9 @@ class UnitHourlyReport:
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
status = UnitHourlyReport().hourly_report()
|
|
|
+ media_name = 'kwai'
|
|
|
+ trace_log = Logger().etl_logger(media_name, UnitHourlyReport().start_time)
|
|
|
if status == 0:
|
|
|
- logging.info("作业执行成功")
|
|
|
+ trace_log.info("作业执行成功")
|
|
|
else:
|
|
|
- logging.info("作业执行失败")
|
|
|
+ trace_log.error("作业执行失败")
|