renyupeng 3 years ago
parent
commit
d90e720543

+ 1 - 1
Apietl/kwai_etl/report/AccountDailyReport.py

@@ -208,7 +208,7 @@ class AccountDailyReport:
         order by account_id,stat_date limit {num},20000
         """.format(start_time=self.start_time, end_time=self.end_time,num=i * 20000)
                 print(sql)
-                TidbConn.exec_sql(self.conn, sql)
+                TidbConn.upsert(conn=self.conn, sql_buff=sql)
                 self.conn.commit()
             return 0
         except Exception as e:

+ 1 - 1
Apietl/kwai_etl/report/AccountHourlyReport.py

@@ -209,7 +209,7 @@ class AccountHourlyReport:
                order by account_id,hour,stat_date limit {num},20000
         """.format(start_time=self.start_time, end_time=self.end_time, num=i * 20000)
                 print(sql)
-                TidbConn.exec_sql(self.conn, sql)
+                TidbConn.upsert(conn=self.conn, sql_buff=sql)
                 self.conn.commit()
             return 0
         except Exception as e:

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

@@ -196,7 +196,7 @@ class AccountReport:
         and report.advertiser_id={account_id}
             """.format(start_date=start_date, end_date=end_date, account_id=account_id)
             print(sql)
-            TidbConn.exec_sql(self.conn, sql)
+            TidbConn.upsert(conn=self.conn, sql_buff=sql)
             self.conn.commit()
         except Exception as e:
             logging.error('失败详细信息:', repr(e))
@@ -383,7 +383,7 @@ class AccountReport:
         and  report.advertiser_id={account_id}
      """.format(start_date=start_date, end_date=end_date, account_id=account_id)
             print(sql)
-            TidbConn.exec_sql(self.conn, sql)
+            TidbConn.upsert(conn=self.conn, sql_buff=sql)
             self.conn.commit()
         except Exception as e:
             logging.error('失败详细信息:', repr(e))

+ 1 - 1
Apietl/kwai_etl/report/CampaignHourlyReport.py

@@ -209,7 +209,7 @@ class CampaignHourlyReport:
         where report.stat_date between {start_time} and {end_time} order by campaign_id,stat_date,`hour` limit {num},20000""". \
                     format(start_time=self.start_time, end_time=self.end_time, num=i * 20000)
                 print(sql)
-                TidbConn.exec_sql(self.conn, sql)
+                TidbConn.upsert(conn=self.conn, sql_buff=sql)
                 self.conn.commit()
             return 0
         except Exception as e:

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

@@ -289,7 +289,7 @@ from media_api.kuaishou_material_video_report_daily report
   order by advertiser_id,photo_id ,stat_date limit {num},20000""".format(
                     start_time=self.start_time, end_time=self.end_time, num=i * 20000)
                 print(sql)
-                TidbConn.exec_sql(self.conn, sql)
+                TidbConn.upsert(conn=self.conn, sql_buff=sql)
                 self.conn.commit()
             return 0
         except Exception as e:

+ 1 - 1
Apietl/kwai_etl/report/MateirialVideoHourlyReport.py

@@ -290,7 +290,7 @@ from media_api.kuaishou_material_video_report_hourly report
   order by advertiser_id,photo_id ,stat_date,`hour` limit {num},20000""".format(
                     start_time=self.start_time, end_time=self.end_time, num=i * 20000)
                 print(sql)
-                TidbConn.exec_sql(self.conn, sql)
+                TidbConn.upsert(conn=self.conn, sql_buff=sql)
                 self.conn.commit()
             return 0
         except Exception as e:

+ 1 - 1
Apietl/kwai_etl/report/UnitDailyReport.py

@@ -212,7 +212,7 @@ class UnitDailyReport:
         where report.stat_date between {start_time} and {end_time} order by unit_id,stat_date limit {num},10000""".\
                     format(start_time=self.start_time, end_time=self.end_time, num=i * 10000)
                 print(sql)
-                TidbConn.exec_sql(self.conn, sql)
+                TidbConn.upsert(conn=self.conn, sql_buff=sql)
                 self.conn.commit()
             return 0
         except Exception as e:

+ 1 - 1
Apietl/kwai_etl/report/UnitHourlyReport.py

@@ -214,7 +214,7 @@ class UnitHourlyReport:
         where report.stat_date between {start_time} and {end_time} order by unit_id,hour,stat_date limit {num},10000""".\
                     format(start_time=self.start_time, end_time=self.end_time,num=i * 10000)
                 print(sql)
-                TidbConn.exec_sql(self.conn, sql)
+                TidbConn.upsert(conn=self.conn, sql_buff=sql)
                 self.conn.commit()
             return 0
         except Exception as e: