lmstack hace 2 años
padre
commit
b3e3825e3b
Se han modificado 1 ficheros con 7 adiciones y 3 borrados
  1. 7 3
      LIB/MIDDLE/AlgoDemo/Demo/V_1_0_0/Main/main.py

+ 7 - 3
LIB/MIDDLE/AlgoDemo/Demo/V_1_0_0/Main/main.py

@@ -66,9 +66,13 @@ if __name__ == '__main__':
         df_diag_ram = pd.read_sql(sql, db_engine)
         
         # 修改数据库示例
-        session = Session()
-        sql = 'insert into table (data) values (:data)'
-        params = {'data':1}
+        # session = Session()
+        # sql = 'insert into table (data) values (:data)'
+        # params = {'data':1}
+        # session.execute(sql,params=params)
+        
+        sql = "update all_fault_info_copy set update_time=:time,end_time=:end_time where product_id=:sn and end_time=:end_time and code=:code"
+        params = {"time":datetime.datetime.now(), "end_time":end_time, "sn":sn, "code":'C493'}
         session.execute(sql,params=params)
         session.commit()
         session.close()