From: Mike Bayer Date: Mon, 21 Jul 2014 15:58:44 +0000 (-0400) Subject: - Fixed bug introduced in 0.9.5 by new pg8000 isolation level feature X-Git-Tag: rel_1_0_0b1~298 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c02e95ed33504f2738261e4e80c28382f94d8d51;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - Fixed bug introduced in 0.9.5 by new pg8000 isolation level feature where engine-level isolation level parameter would raise an error on connect. fixes #3134 --- diff --git a/doc/build/changelog/changelog_09.rst b/doc/build/changelog/changelog_09.rst index cfb5cb691c..326779d4af 100644 --- a/doc/build/changelog/changelog_09.rst +++ b/doc/build/changelog/changelog_09.rst @@ -14,6 +14,15 @@ :version: 0.9.7 :released: + .. change:: + :tags: bug, postgresql, pg8000 + :tickets: 3134 + :versions: 1.0.0 + + Fixed bug introduced in 0.9.5 by new pg8000 isolation level feature + where engine-level isolation level parameter would raise an error + on connect. + .. change:: :tags: bug, oracle, tests :tickets: 3128 diff --git a/lib/sqlalchemy/dialects/postgresql/pg8000.py b/lib/sqlalchemy/dialects/postgresql/pg8000.py index 512f3e1b09..589567d9e9 100644 --- a/lib/sqlalchemy/dialects/postgresql/pg8000.py +++ b/lib/sqlalchemy/dialects/postgresql/pg8000.py @@ -150,10 +150,14 @@ class PGDialect_pg8000(PGDialect): def set_isolation_level(self, connection, level): level = level.replace('_', ' ') + # adjust for ConnectionFairy possibly being present + if hasattr(connection, 'connection'): + connection = connection.connection + if level == 'AUTOCOMMIT': - connection.connection.autocommit = True + connection.autocommit = True elif level in self._isolation_lookup: - connection.connection.autocommit = False + connection.autocommit = False cursor = connection.cursor() cursor.execute( "SET SESSION CHARACTERISTICS AS TRANSACTION " diff --git a/test/requirements.py b/test/requirements.py index 09f9735439..f4fd6b601a 100644 --- a/test/requirements.py +++ b/test/requirements.py @@ -361,6 +361,7 @@ class DefaultRequirements(SuiteRequirements): 'need separate XA implementation'), exclude('mysql', '<', (5, 0, 3), 'two-phase xact not supported by database'), + no_support("postgresql+pg8000", "not supported and/or hangs") ]) @property