summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSalvatore Incandela <s.incandela@gmail.com>2016-10-26 10:48:26 +0200
committerSalvatore Incandela <s.incandela@gmail.com>2016-10-26 10:48:26 +0200
commit09fbef32b40d1d6ab91728469148d7308274954b (patch)
tree5b7154c3c56d4432befead6e8c457d6dbaf62ac7
parent1f32d014da5d40406cd5d3996be5283c2fc57b26 (diff)
downloadsqlalchemy-pr/317.tar.gz
postgres basy.py support to teiid virtual database connection patchpr/317
-rw-r--r--lib/sqlalchemy/dialects/postgresql/base.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py
index 9898e4ba4..eeee7af54 100644
--- a/lib/sqlalchemy/dialects/postgresql/base.py
+++ b/lib/sqlalchemy/dialects/postgresql/base.py
@@ -1948,6 +1948,7 @@ class PGDialect(default.DefaultDialect):
execution_ctx_cls = PGExecutionContext
inspector = PGInspector
isolation_level = None
+ supports_isolation_level = False
construct_arguments = [
(schema.Index, {
@@ -2032,11 +2033,14 @@ class PGDialect(default.DefaultDialect):
cursor.close()
def get_isolation_level(self, connection):
- cursor = connection.cursor()
- cursor.execute('show transaction isolation level')
- val = cursor.fetchone()[0]
- cursor.close()
- return val.upper()
+ if self.supports_isolation_level:
+ cursor = connection.cursor()
+ cursor.execute('show transaction isolation level')
+ val = cursor.fetchone()[0]
+ cursor.close()
+ return val.upper()
+ else:
+ return 'READ COMMITTED'
def do_begin_twophase(self, connection, xid):
self.do_begin(connection.connection)
@@ -2191,9 +2195,10 @@ class PGDialect(default.DefaultDialect):
def _get_server_version_info(self, connection):
v = connection.execute("select version()").scalar()
m = re.match(
- '.*(?:PostgreSQL|EnterpriseDB) '
+ '.*(?:PostgreSQL|EnterpriseDB|Teiid) '
'(\d+)\.(\d+)(?:\.(\d+))?(?:\.\d+)?(?:devel)?',
v)
+ self.supports_isolation_level = not bool('Teiid' in v)
if not m:
raise AssertionError(
"Could not determine version from string '%s'" % v)