]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Warn for mariadb 10.2 < 9
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 28 Sep 2017 16:31:54 +0000 (12:31 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 28 Sep 2017 16:34:33 +0000 (12:34 -0400)
There's a few CHECK constraint issues we managed
to get resolved as of MariaDB 10.2.8 then 10.2.9.   They
are pretty severe so warn users for these particular mariadb
versions.

Change-Id: Ie0899f94fda25960975ebee72f3044370f43eb7c
Fixes: #4097
(cherry picked from commit 21bf37f6e429276aa8cc60c1aa756e4bafa74b3e)

lib/sqlalchemy/dialects/mysql/base.py

index 2dd8b8bac1bc49d2bff8d19aca5e3b6d842d09ce..2f7353ee5b71aee17b8b4d345c34f701cfaf2e55 100644 (file)
@@ -1721,6 +1721,21 @@ class MySQLDialect(default.DefaultDialect):
 
         default.DefaultDialect.initialize(self, connection)
 
+        self._warn_for_known_db_issues()
+
+    def _warn_for_known_db_issues(self):
+        if self._is_mariadb:
+            mdb_version = self._mariadb_normalized_version_info
+            if mdb_version > (10, 2) and mdb_version < (10, 2, 9):
+                util.warn(
+                    "MariaDB %r before 10.2.9 has known issues regarding "
+                    "CHECK constraints, which impact handling of NULL values "
+                    "with SQLAlchemy's boolean datatype (MDEV-13596). An "
+                    "additional issue prevents proper migrations of columns "
+                    "with CHECK constraints (MDEV-11114).  Please upgrade to "
+                    "MariaDB 10.2.9 or greater, or use the MariaDB 10.1 "
+                    "series, to avoid these issues." % (mdb_version, ))
+
     @property
     def _is_mariadb(self):
         return 'MariaDB' in self.server_version_info