renyupeng 4 kuukautta sitten
vanhempi
commit
fa5a13b138
1 muutettua tiedostoa jossa 4 lisäystä ja 5 poistoa
  1. 4 5
      Apietl/kwai_etl/report/CampaignHourlyReport.py

+ 4 - 5
Apietl/kwai_etl/report/CampaignHourlyReport.py

@@ -20,13 +20,12 @@ class CampaignHourlyReport:
         self.conn = TidbConn.get_connection()
         self.parm = Utils.get_args()
         self.start_time = self.parm[0]
-        self.end_time = self.parm[1]
 
     def hourly_report(self):
         try:
             sql = """select advertiser_id from media_api.kuaishou_campaign_report_hourly where 
-            stat_date between {start_time} and {end_time} group by advertiser_id""".format(
-                start_time=self.start_time, end_time=self.end_time)
+            stat_date = {start_time}  and cost>0 group by advertiser_id""".format(
+                start_time=self.start_time, end_time=self.  end_time)
             account_list = TidbConn.quary(self.conn, sql)
             for account_id in account_list:
                 sql = """replace into application.kuaishou_campaign_report_hourly_dw
@@ -230,8 +229,8 @@ WHERE
 cua.account_id IS NOT NULL
              ) sys
              on report.advertiser_id = sys.account_id
-        where report.stat_date between {start_time} and {end_time} and report.advertiser_id = {account_id}""". \
-                    format(start_time=self.start_time, end_time=self.end_time, account_id=account_id[0])
+        where report.stat_date = {start_time} and report.advertiser_id = {account_id}""". \
+                    format(start_time=self.start_time, account_id=account_id[0])
                 print(sql)
                 TidbConn.upsert(conn=self.conn, sql_buff=sql)
                 self.conn.commit()