Skip to content

Commit f1384aa

Browse files
committed
commit on exit = False by default
1 parent e4b46f1 commit f1384aa

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

fastapi_async_sqlalchemy/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
__all__ = ["db", "SQLAlchemyMiddleware"]
44

5-
__version__ = "0.3.4"
5+
__version__ = "0.3.5"

fastapi_async_sqlalchemy/middleware.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def session(self) -> AsyncSession:
6363

6464

6565
class DBSession(metaclass=DBSessionMeta):
66-
def __init__(self, session_args: Dict = None, commit_on_exit: bool = True):
66+
def __init__(self, session_args: Dict = None, commit_on_exit: bool = False):
6767
self.token = None
6868
self.session_args = session_args or {}
6969
self.commit_on_exit = commit_on_exit

tests/test_session.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ async def test_db_context_session_args(app, db, SQLAlchemyMiddleware, commit_on_
103103

104104
session_args = {}
105105

106-
async with db(session_args=session_args):
106+
async with db(session_args=session_args, commit_on_exit=True):
107107
assert isinstance(db.session, AsyncSession)
108108

109109
# assert db.session.expire_on_commit

0 commit comments

Comments
 (0)