From f662dfc9d93f89ec16f87348ccf34af3b3d684da Mon Sep 17 00:00:00 2001 From: Huw Jones Date: Sat, 16 Sep 2023 10:41:16 +0100 Subject: [PATCH] sql/sqltypes/Enum: explicitly document values_callable order (#10248) Fixes #9911 --- lib/sqlalchemy/sql/sqltypes.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 -- 2.47.3