diff options
-rw-r--r-- | lib/sqlalchemy/engine/base.py | 1 | ||||
-rw-r--r-- | test/engine/test_execute.py | 12 |
2 files changed, 13 insertions, 0 deletions
diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py index 2cad2a094..4a8719c6b 100644 --- a/lib/sqlalchemy/engine/base.py +++ b/lib/sqlalchemy/engine/base.py @@ -1502,6 +1502,7 @@ class Engine(Connectable, log.Identified): """ self.pool.dispose() + self.pool = self.pool.recreate() def _execute_default(self, default): with self.contextual_connect() as conn: diff --git a/test/engine/test_execute.py b/test/engine/test_execute.py index 6efcdcb89..830b62531 100644 --- a/test/engine/test_execute.py +++ b/test/engine/test_execute.py @@ -449,6 +449,18 @@ class ExecuteTest(fixtures.TestBase): assert eng.dialect.returns_unicode_strings in (True, False) eng.dispose() + def test_works_after_dispose(self): + eng = create_engine(testing.db.url) + for i in range(3): + eq_(eng.scalar(select([1])), 1) + eng.dispose() + + def test_works_after_dispose_testing_engine(self): + eng = engines.testing_engine() + for i in range(3): + eq_(eng.scalar(select([1])), 1) + eng.dispose() + class ConvenienceExecuteTest(fixtures.TablesTest): @classmethod def define_tables(cls, metadata): |