python3中pymysql模块的事务操作
2023-09-14 09:00:32 时间
try:
cursor.execute(sql_1)
cursor.execute(sql_2)
cursor.execute(sql_3)
except Exception as e:
connect.rollback() # 事务回滚
print('事务处理失败', e)
else:
connect.commit() # 事务提交
print('事务处理成功', cursor.rowcount)# 关闭连接
cursor.close()
connect.close()
相关文章
- Python3的WHILE,IF例句
- python3 和python2文件相互转换
- Python3赋值运算符
- python3 import导入模块
- Python3 operator 模块
- エンジニア死滅シタ世界之高層ビル [MISSION LEVEL: B]-Python3
- 【LeetCode 简单 数组 python3】88. 合并两个有序数组
- 【LeetCode 中等 数组 python3】209. 长度最小的子数组
- python3 urllib和requests模块
- 拉取webrtc代码报错:python3/bin/python3: 没有那个文件或目录
- python3(八)sys模块
- python3调用graphviz绘制流程图
- python3 元组 tuple--讲义