renyupeng 11 月之前
父节点
当前提交
7bb0b3b95a
共有 2 个文件被更改,包括 3 次插入3 次删除
  1. 2 3
      Apietl/utlis/EtlFirstDeliveryValidMaterials.py
  2. 1 0
      Apietl/utlis/UpLoadFile.py

+ 2 - 3
Apietl/utlis/EtlFirstDeliveryValidMaterials.py

@@ -19,9 +19,6 @@ class EtlFirstDeliveryValidMaterials:
 
 
     def handler(self):
     def handler(self):
         try:
         try:
-            sql = """truncate table `jeecg-boot`.`first_delivery_valid_materials`"""
-            TidbConn.exec_sql(self.conn, sql)
-
             sql = """
             sql = """
       replace  into `jeecg-boot`.`etl_first_delivery_valid_materials`
       replace  into `jeecg-boot`.`etl_first_delivery_valid_materials`
         select `delivery_month`,
         select `delivery_month`,
@@ -73,6 +70,8 @@ class EtlFirstDeliveryValidMaterials:
             """.format(stat_date=self.stat_date)
             """.format(stat_date=self.stat_date)
             print(sql)
             print(sql)
             TidbConn.upsert(conn=self.conn, sql_buff=sql)
             TidbConn.upsert(conn=self.conn, sql_buff=sql)
+            truncate_sql = "truncate table `jeecg-boot`.first_delivery_valid_materials"
+            TidbConn.exec_sql(conn=self.conn, sql_buff=truncate_sql)
             self.conn.commit()
             self.conn.commit()
             TidbConn.conn_close(conn=self.conn)
             TidbConn.conn_close(conn=self.conn)
             return 0
             return 0

+ 1 - 0
Apietl/utlis/UpLoadFile.py

@@ -22,6 +22,7 @@ class UpLoadFile:
                                   max_overflow=5,
                                   max_overflow=5,
                                   pool_timeout=10,
                                   pool_timeout=10,
                                   pool_recycle=3600)
                                   pool_recycle=3600)
+
         chunksize = 100000
         chunksize = 100000
 
 
         for chunk in pd.read_csv(f'/home/excel/{file_name}'.format(file_name=file_name),
         for chunk in pd.read_csv(f'/home/excel/{file_name}'.format(file_name=file_name),