- changed status to resolved
reset isolation level fails on invalided connection
Issue #3302
resolved
>>> from sqlalchemy import create_engine
>>> e = create_engine("sqlite://")
>>> c1 = e.connect()
>>> c2 = c1.execution_options(isolation_level='SERIALIZABLE')
>>> c2.invalidate()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/engine/base.py", line 482, in invalidate
self._root.__connection.invalidate(exception)
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/pool.py", line 759, in invalidate
self._checkin()
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/pool.py", line 682, in _checkin
self._pool, None, self._echo, fairy=self)
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/pool.py", line 580, in _finalize_fairy
connection_record.checkin()
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/pool.py", line 466, in checkin
finalizer(connection)
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/engine/default.py", line 454, in reset_isolation_level
self.set_isolation_level(dbapi_conn, self.default_isolation_level)
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/dialects/sqlite/base.py", line 868, in set_isolation_level
cursor = connection.cursor()
AttributeError: 'NoneType' object has no attribute 'cursor'
>>>
Comments (2)
-
reporter -
reporter - Fixed bug in :class:
.Connection
and pool where the :meth:.Connection.invalidate
method, or an invalidation due to a database disconnect, would fail if theisolation_level
parameter had been used with :meth:.Connection.execution_options
; the "finalizer" that resets the isolation level would be called on the no longer opened connection. fixes#3302
(cherry picked from commit 068f9a1531c8114360d5fcd964c27fe6a21f4679)
→ <<cset 7c196d16fed5>>
- Fixed bug in :class:
- Log in to comment
.Connection
and pool where the :meth:.Connection.invalidate
method, or an invalidation due to a database disconnect, would fail if theisolation_level
parameter had been used with :meth:.Connection.execution_options
; the "finalizer" that resets the isolation level would be called on the no longer opened connection. fixes#3302→ <<cset 068f9a1531c8>>