summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormike bayer <mike_mp@zzzcomputing.com>2017-10-23 20:35:35 -0400
committerGerrit Code Review <gerrit@ci.zzzcomputing.com>2017-10-23 20:35:35 -0400
commit7482ba0b3cf467aeaa87218020a357ad18325df8 (patch)
treeadacdc7557d15f05e5591b59922554ae2e489fbc
parent1c025e9795315283e548ad4f1a2b31d923104a38 (diff)
parent41cfe44b5e5806b3d3b13949e41dbb347bfa29e1 (diff)
downloadsqlalchemy-7482ba0b3cf467aeaa87218020a357ad18325df8.tar.gz
Merge "Remove deprecation warnings mysql5 7 20"
-rw-r--r--doc/build/changelog/unreleased_11/4120.rst8
-rw-r--r--lib/sqlalchemy/dialects/mysql/base.py9
2 files changed, 16 insertions, 1 deletions
diff --git a/doc/build/changelog/unreleased_11/4120.rst b/doc/build/changelog/unreleased_11/4120.rst
new file mode 100644
index 000000000..e84c1ac19
--- /dev/null
+++ b/doc/build/changelog/unreleased_11/4120.rst
@@ -0,0 +1,8 @@
+.. change::
+ :tags: bug, mysql
+ :tickets: 4120
+ :versions: 1.2.0b4
+
+ MySQL 5.7.20 now warns for use of the @tx_isolation variable; a version
+ check is now performed and uses @transaction_isolation instead
+ to prevent this warning.
diff --git a/lib/sqlalchemy/dialects/mysql/base.py b/lib/sqlalchemy/dialects/mysql/base.py
index 5acb9a005..2aaeacb19 100644
--- a/lib/sqlalchemy/dialects/mysql/base.py
+++ b/lib/sqlalchemy/dialects/mysql/base.py
@@ -1720,7 +1720,10 @@ class MySQLDialect(default.DefaultDialect):
def get_isolation_level(self, connection):
cursor = connection.cursor()
- cursor.execute('SELECT @@tx_isolation')
+ if self._is_mysql and self.server_version_info >= (5, 7, 20):
+ cursor.execute('SELECT @@transaction_isolation')
+ else:
+ cursor.execute('SELECT @@tx_isolation')
val = cursor.fetchone()[0]
cursor.close()
if util.py3k and isinstance(val, bytes):
@@ -1888,6 +1891,10 @@ class MySQLDialect(default.DefaultDialect):
return 'MariaDB' in self.server_version_info
@property
+ def _is_mysql(self):
+ return 'MariaDB' not in self.server_version_info
+
+ @property
def _is_mariadb_102(self):
return self._is_mariadb and \
self._mariadb_normalized_version_info > (10, 2)