summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/mysql/enumerated.py
diff options
context:
space:
mode:
authorJon Snyder <snyder.jon@gmail.com>2018-01-17 16:37:59 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2018-02-07 21:22:27 -0500
commita54b3bb0a8a3a33c4c68349484ef4f3dc915416e (patch)
tree6f34531039642ee92932c0b565269cb43ea7f11f /lib/sqlalchemy/dialects/mysql/enumerated.py
parentba957f84d333918ca34d562b407cc6d65bccbccb (diff)
downloadsqlalchemy-a54b3bb0a8a3a33c4c68349484ef4f3dc915416e.tar.gz
Add values_callable feature to Enum
Added support for :class:`.Enum` to persist the values of the enumeration, rather than the keys, when using a Python pep-435 style enumerated object. The user supplies a callable function that will return the string values to be persisted. This allows enumerations against non-string values to be value-persistable as well. Pull request courtesy Jon Snyder. Pull-request: https://github.com/zzzeek/sqlalchemy/pull/410 Fixes: #3906 Change-Id: Id385465d215d1e5baaad68368b168afdd846b82c
Diffstat (limited to 'lib/sqlalchemy/dialects/mysql/enumerated.py')
-rw-r--r--lib/sqlalchemy/dialects/mysql/enumerated.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/sqlalchemy/dialects/mysql/enumerated.py b/lib/sqlalchemy/dialects/mysql/enumerated.py
index dfbe96b4a..f63d64e8f 100644
--- a/lib/sqlalchemy/dialects/mysql/enumerated.py
+++ b/lib/sqlalchemy/dialects/mysql/enumerated.py
@@ -126,6 +126,7 @@ class ENUM(sqltypes.NativeForEmulated, sqltypes.Enum, _EnumeratedValues):
"""
kw.setdefault("validate_strings", impl.validate_strings)
+ kw.setdefault("values_callable", impl.values_callable)
return cls(**kw)
def _setup_for_values(self, values, objects, kw):