From 91a1022227499c8efce038c4a0a9bdcdb14a69d0 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Mon, 20 Jun 2016 10:08:36 -0400 Subject: Disable Enum string validation by default Rolled back the validation rules a bit in :class:`.Enum` to allow unknown string values to pass through, unless the flag ``validate_string=True`` is passed to the Enum; any other kind of object is still of course rejected. While the immediate use is to allow comparisons to enums with LIKE, the fact that this use exists indicates there may be more unknown-string-comparsion use cases than we expected, which hints that perhaps there are some unknown string-INSERT cases too. Change-Id: I7d1d79b374a7d47966d410998f77cd19294ab7b0 Fixes: #3725 --- lib/sqlalchemy/dialects/mysql/enumerated.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/sqlalchemy/dialects/mysql/enumerated.py') diff --git a/lib/sqlalchemy/dialects/mysql/enumerated.py b/lib/sqlalchemy/dialects/mysql/enumerated.py index 567e95288..a47d94ca7 100644 --- a/lib/sqlalchemy/dialects/mysql/enumerated.py +++ b/lib/sqlalchemy/dialects/mysql/enumerated.py @@ -114,7 +114,9 @@ class ENUM(sqltypes.Enum, _EnumeratedValues): """ kw.pop('strict', None) - sqltypes.Enum.__init__(self, *enums) + validate_strings = kw.pop("validate_strings", False) + sqltypes.Enum.__init__( + self, validate_strings=validate_strings, *enums) kw.pop('metadata', None) kw.pop('schema', None) kw.pop('name', None) -- cgit v1.2.1