]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Add values_callable feature to Enum
authorJon Snyder <snyder.jon@gmail.com>
Wed, 17 Jan 2018 21:37:59 +0000 (16:37 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 8 Feb 2018 02:22:27 +0000 (21:22 -0500)
commita54b3bb0a8a3a33c4c68349484ef4f3dc915416e
tree6f34531039642ee92932c0b565269cb43ea7f11f
parentba957f84d333918ca34d562b407cc6d65bccbccb
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
doc/build/changelog/unreleased_12/3906.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/mysql/enumerated.py
lib/sqlalchemy/dialects/postgresql/base.py
lib/sqlalchemy/sql/sqltypes.py
test/dialect/mysql/test_types.py
test/sql/test_types.py