]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
sql/sqltypes/Enum: explicitly document values_callable order (#10248)
authorHuw Jones <huw@huwcbjones.co.uk>
Sat, 16 Sep 2023 09:41:16 +0000 (10:41 +0100)
committerGitHub <noreply@github.com>
Sat, 16 Sep 2023 09:41:16 +0000 (11:41 +0200)
Fixes #9911

lib/sqlalchemy/sql/sqltypes.py

index da7f7300bc9fd0d1d0937ee45115fed008d31d80..343575f196e763886ee11611c9daa66b42d1a2ad 100644 (file)
@@ -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