- changed status to resolved
branched connection does not propagate invalidation to parent
Issue #3215
resolved
from sqlalchemy import create_engine, exc
e = create_engine("postgresql://scott:tiger@localhost/test", echo=True)
def test_one():
c1 = e.connect()
dbapi_conn = c1.connection.connection
dbapi_conn.close()
try:
c1.execute("select 'hi'")
except exc.DBAPIError:
pass
assert c1.invalidated
c1.execute("select 'hi'")
assert not c1.invalidated
c1.close()
def test_two():
c2 = e.connect()
c2_branch = c2.connect()
dbapi_conn = c2.connection.connection
dbapi_conn.close()
try:
c2_branch.execute("select 'hi'")
except exc.DBAPIError:
pass
assert c2_branch.invalidated
# fails
assert c2.invalidated
# sqlalchemy.exc.StatementError: 'NoneType' object
# has no attribute 'cursor' (original cause: AttributeError:
# 'NoneType' object has no attribute 'cursor') u"select 'hi'" []
c2.execute("select 'hi'")
assert not c2_branch.invalidated
c2.close()
test_one()
test_two()
Comments (1)
-
reporter - Log in to comment
.Connection.connect
, would not share invalidation status with the parent. The architecture of branching has been tweaked a bit so that the branched connection defers to the parent for all invalidation status and operations. fixes#3215→ <<cset fbddf193a684>>