summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2019-03-08 18:36:33 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2019-03-08 23:45:25 -0500
commitcbc31716c2cef29f45506c6227c2154e3093c845 (patch)
tree9df380e01965a2c8b4641953722b090c2ad0d4a4 /lib/sqlalchemy
parentd514c032cd0349afc93f89d5b99835198ae70112 (diff)
downloadsqlalchemy-cbc31716c2cef29f45506c6227c2154e3093c845.tar.gz
Commit transaction after SNAPSHOT isolation change
A commit() is emitted after an isolation level change to SNAPSHOT, as both pyodbc and pymssql open an implicit transaction which blocks subsequent SQL from being emitted in the current transaction. Fixes: #4536 Change-Id: If3ba70f495bce2a35a873a3a72d1b30406e678c8
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r--lib/sqlalchemy/dialects/mssql/base.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/sqlalchemy/dialects/mssql/base.py b/lib/sqlalchemy/dialects/mssql/base.py
index 2d883309d..992b97188 100644
--- a/lib/sqlalchemy/dialects/mssql/base.py
+++ b/lib/sqlalchemy/dialects/mssql/base.py
@@ -2235,6 +2235,8 @@ class MSDialect(default.DefaultDialect):
cursor = connection.cursor()
cursor.execute("SET TRANSACTION ISOLATION LEVEL %s" % level)
cursor.close()
+ if level == "SNAPSHOT":
+ connection.commit()
def get_isolation_level(self, connection):
if self.server_version_info < MS_2005_VERSION: