summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2014-07-21 11:58:44 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2014-07-21 11:58:44 -0400
commitc02e95ed33504f2738261e4e80c28382f94d8d51 (patch)
tree5071449ecc728a42bf69ae1d61493c89642a9afb
parent72ac9c189248c726e3ed04e5fe2e6b7ec599d24c (diff)
downloadsqlalchemy-c02e95ed33504f2738261e4e80c28382f94d8d51.tar.gz
- 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
-rw-r--r--doc/build/changelog/changelog_09.rst9
-rw-r--r--lib/sqlalchemy/dialects/postgresql/pg8000.py8
-rw-r--r--test/requirements.py1
3 files changed, 16 insertions, 2 deletions
diff --git a/doc/build/changelog/changelog_09.rst b/doc/build/changelog/changelog_09.rst
index cfb5cb691..326779d4a 100644
--- a/doc/build/changelog/changelog_09.rst
+++ b/doc/build/changelog/changelog_09.rst
@@ -15,6 +15,15 @@
: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
:versions: 1.0.0
diff --git a/lib/sqlalchemy/dialects/postgresql/pg8000.py b/lib/sqlalchemy/dialects/postgresql/pg8000.py
index 512f3e1b0..589567d9e 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 09f973543..f4fd6b601 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