From: Huw Jones Date: Sat, 16 Sep 2023 09:41:16 +0000 (+0100) Subject: sql/sqltypes/Enum: explicitly document values_callable order (#10248) X-Git-Tag: rel_2_0_21~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f662dfc9d93f89ec16f87348ccf34af3b3d684da;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git sql/sqltypes/Enum: explicitly document values_callable order (#10248) Fixes #9911 --- diff --git a/lib/sqlalchemy/sql/sqltypes.py b/lib/sqlalchemy/sql/sqltypes.py index da7f7300bc..343575f196 100644 --- a/lib/sqlalchemy/sql/sqltypes.py +++ b/lib/sqlalchemy/sql/sqltypes.py @@ -1402,7 +1402,10 @@ class Enum(String, SchemaType, Emulated, TypeEngine[Union[str, enum.Enum]]): compliant enumerated type, which should then return a list of string values to be persisted. This allows for alternate usages such as using the string value of an enum to be persisted to the database - instead of its name. + instead of its name. The callable must return the values to be + persisted in the same order as iterating through the Enum's + ``__member__`` attribute. For example + ``lambda x: [i.value for i in x]``. .. versionadded:: 1.2.3