You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following a failed commit, the database connection needs to be rollback before it can be used again (keep_session is not being used).
When using a TransactionManager in explicit mode, attempts to start a new transaction generate an AlreadyInTransaction exception (even though we are using context managers to scope transactions). This happens with sqlite even without the lazy transaction workaround, but it does not happen with postgres.
BUG/PROBLEM REPORT (OR OTHER COMMON ISSUE)
While upgrading a project from sqlalchemy 1.3 to 1.4, I ran into this problem that only occurs when using a sqlite database with this workaround for the pysqlite lazy transaction behavior.
Following a failed commit, the database connection needs to be rollback before it can be used again (keep_session is not being used).
When using a
TransactionManager
inexplicit
mode, attempts to start a new transaction generate anAlreadyInTransaction
exception (even though we are using context managers to scope transactions). This happens with sqlite even without the lazy transaction workaround, but it does not happen with postgres.With SQLAlchemy 1.4
session.begin()
TransactionManager(explicit=False)
TransactionManager(explicit=True)
AlreadyInTransaction
OperationalError
AlreadyInTransaction
With SQLAlchemy 1.3
session.transaction
TransactionManager(explicit=False)
TransactionManager(explicit=True)
AlreadyInTransaction
AlreadyInTransaction
What I did:
Minimal test case at https://gist.github.com/8bee5b88dea060eaafb0402208771e65
What I expect to happen:
The second transaction should succeed.
What actually happened:
The second transaction fails with
or (when using an explicit mode
TransactionManager
)What version of Python and Zope/Addons I am using:
CPython 3.6 (but also verified with 3.10)
SQLAlchemy==1.4.41
transaction==3.0.1
zope.sqlalchemy==1.6
The text was updated successfully, but these errors were encountered: