[Sqlalchemy-tickets] Issue #3215: branched connection does not propagate invalidation to parent (zz
Brought to you by:
zzzeek
|
From: Mike B. <iss...@bi...> - 2014-09-26 18:30:30
|
New issue 3215: branched connection does not propagate invalidation to parent https://bitbucket.org/zzzeek/sqlalchemy/issue/3215/branched-connection-does-not-propagate Mike Bayer: ``` #!python 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() ``` |