summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/testing/provision.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2018-06-24 13:06:38 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2018-06-25 16:43:37 -0400
commitc99345ee9994c3ea2a5e6536cc3365f18d017cc1 (patch)
tree43e68f5a4872398c6c1b0a7304c2413f942c56d5 /lib/sqlalchemy/testing/provision.py
parent7d2a581a58e9ca4ffbcb39a384ba6950a966de7a (diff)
downloadsqlalchemy-c99345ee9994c3ea2a5e6536cc3365f18d017cc1.tar.gz
Use utf8mb4 (or utf8mb3) for all things MySQL
Fixed bug in MySQLdb dialect and variants such as PyMySQL where an additional "unicode returns" check upon connection makes explicit use of the "utf8" character set, which in MySQL 8.0 emits a warning that utf8mb4 should be used. This is now replaced with a utf8mb4 equivalent. Documentation is also updated for the MySQL dialect to specify utf8mb4 in all examples. Additional changes have been made to the test suite to use utf8mb3 charsets and databases (there seem to be collation issues in some edge cases with utf8mb4), and to support configuration default changes made in MySQL 8.0 such as explicit_defaults_for_timestamp as well as new errors raised for invalid MyISAM indexes. Change-Id: Ib596ea7de4f69f976872a33bffa4c902d17dea25 Fixes: #4283 Fixes: #4192
Diffstat (limited to 'lib/sqlalchemy/testing/provision.py')
-rw-r--r--lib/sqlalchemy/testing/provision.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/sqlalchemy/testing/provision.py b/lib/sqlalchemy/testing/provision.py
index 687f84b18..8abfa3301 100644
--- a/lib/sqlalchemy/testing/provision.py
+++ b/lib/sqlalchemy/testing/provision.py
@@ -194,9 +194,15 @@ def _mysql_create_db(cfg, eng, ident):
_mysql_drop_db(cfg, conn, ident)
except Exception:
pass
- conn.execute("CREATE DATABASE %s" % ident)
- conn.execute("CREATE DATABASE %s_test_schema" % ident)
- conn.execute("CREATE DATABASE %s_test_schema_2" % ident)
+
+ # using utf8mb4 we are getting collation errors on UNIONS:
+ # test/orm/inheritance/test_polymorphic_rel.py"
+ # 1271, u"Illegal mix of collations for operation 'UNION'"
+ conn.execute("CREATE DATABASE %s CHARACTER SET utf8mb3" % ident)
+ conn.execute(
+ "CREATE DATABASE %s_test_schema CHARACTER SET utf8mb3" % ident)
+ conn.execute(
+ "CREATE DATABASE %s_test_schema_2 CHARACTER SET utf8mb3" % ident)
@_configure_follower.for_db("mysql")