From 302e8dee82718df6c3a46de4c5283bdae51a650a Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 7 Aug 2020 14:51:33 -0400 Subject: Don't link on_connect to first_connect event handler Adjusted the dialect initialization process such that the :meth:`_engine.Dialect.on_connect` is not called a second time on the first connection. The hook is called first, then the :meth:`_engine.Dialect.initialize` is called if that connection is the first for that dialect, then no more events are called. This eliminates the two calls to the "on_connect" function which can produce very difficult debugging situations. Fixes: #5497 Change-Id: Icefc2e884e30ee7b4ac84b99dc54bf992a6085e3 --- lib/sqlalchemy/testing/engines.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/sqlalchemy/testing') diff --git a/lib/sqlalchemy/testing/engines.py b/lib/sqlalchemy/testing/engines.py index 280e6901e..bb137cb32 100644 --- a/lib/sqlalchemy/testing/engines.py +++ b/lib/sqlalchemy/testing/engines.py @@ -336,6 +336,9 @@ class DBAPIProxyCursor(object): def executemany(self, stmt, params, **kw): return self.cursor.executemany(stmt, params, **kw) + def __iter__(self): + return iter(self.cursor) + def __getattr__(self, key): return getattr(self.cursor, key) -- cgit v1.2.1