From 5dcc32fd5a81c41b50bc35573d190a60a344c3c6 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Mon, 15 Mar 2010 13:08:31 -0400 Subject: - The visit_pool() method of Dialect is removed, and replaced with on_connect(). This method returns a callable which receives the raw DBAPI connection after each one is created. The callable is assembled into a first_connect/connect pool listener by the connection strategy if non-None. Provides a simpler interface for dialects. --- lib/sqlalchemy/dialects/sqlite/base.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'lib/sqlalchemy/dialects/sqlite') diff --git a/lib/sqlalchemy/dialects/sqlite/base.py b/lib/sqlalchemy/dialects/sqlite/base.py index 5bcf90151..dfc09f025 100644 --- a/lib/sqlalchemy/dialects/sqlite/base.py +++ b/lib/sqlalchemy/dialects/sqlite/base.py @@ -360,21 +360,21 @@ class SQLiteDialect(default.DefaultDialect): # hypothetical driver ?) self.native_datetime = native_datetime - def visit_pool(self, pool): + def on_connect(self): if self.isolation_level is not None: - class SetIsolationLevel(object): - def __init__(self, isolation_level): - if isolation_level == 'READ UNCOMMITTED': - self.isolation_level = 1 - else: - self.isolation_level = 0 - - def connect(self, conn, rec): - cursor = conn.cursor() - cursor.execute("PRAGMA read_uncommitted = %d" % self.isolation_level) - cursor.close() - pool.add_listener(SetIsolationLevel(self.isolation_level)) - + if self.isolation_level == 'READ UNCOMMITTED': + isolation_level = 1 + else: + isolation_level = 0 + + def connect(conn): + cursor = conn.cursor() + cursor.execute("PRAGMA read_uncommitted = %d" % isolation_level) + cursor.close() + return connect + else: + return None + def table_names(self, connection, schema): if schema is not None: qschema = self.identifier_preparer.quote_identifier(schema) -- cgit v1.2.1