File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 22title : 事务
33---
44
5- 默认情况下,如果将数据库引擎参数 ` echo ` 设置为 True,你将会看到事务总是被开启,即便那是一个查询语句;但这并不是因为我们错误的使用了
6- SQLAlchemy,你可以查看 [ #6921 ] ( https://github.com/sqlalchemy/sqlalchemy/discussions/6921 ) 了解详情
5+ 默认情况下,如果将数据库引擎参数 ` echo ` 设置为 True,你将会看到事务总是被开启,即便那是一个查询语句。但这并不是因为我们错误的使用了
6+ SQLAlchemy,你可以查看 [ #6921 ] ( https://github.com/sqlalchemy/sqlalchemy/discussions/6921 ) 、[ #12782 ] ( https://github.com/sqlalchemy/sqlalchemy/discussions/12782 )
7+ 了解详情
78
89::: details 简要总结
9- 任何遵循 [ PEP-429] ( https://peps.python.org/pep-0249 ) 进行设计的 Python 数据库连接器或 ORM,都将默认开启事务,你仅可以控制事务是否默认执行提交
10+ 任何遵循 [ PEP-429] ( https://peps.python.org/pep-0249 ) 进行设计的 Python 数据库连接器或 ORM,都将默认开启事务
1011
1112在 SQLAlchemy 中,你可以选择不使用它自身的事务模式,但这需要将数据库本身的事务隔离级别设置为 ` AUTOCOMMIT `
1213,详情请查看: [ 了解 DBAPI 级别的 Autocommit 隔离级别] ( https://docs.sqlalchemy.org.cn/en/20/core/connections.html#understanding-the-dbapi-level-autocommit-isolation-level )
You can’t perform that action at this time.
0 commit comments