diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2017-02-01 18:09:45 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2017-02-01 18:09:45 -0500 |
| commit | 8342ca6c6932b8a30f4ea9650721244eeda35d51 (patch) | |
| tree | 195d7376f110dec52b83542920d971f88be7f09c /lib | |
| parent | 6b27d78030a754f4c95cba6dce20734de9673025 (diff) | |
| download | sqlalchemy-8342ca6c6932b8a30f4ea9650721244eeda35d51.tar.gz | |
- add a note referring to the enum value as not currently persisted,
reference #3906
Change-Id: I2274c356cc88cd011c5a34a69e75a2548a93e87a
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/sqlalchemy/sql/sqltypes.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/sqlalchemy/sql/sqltypes.py b/lib/sqlalchemy/sql/sqltypes.py index 9b48e839f..78a130f62 100644 --- a/lib/sqlalchemy/sql/sqltypes.py +++ b/lib/sqlalchemy/sql/sqltypes.py @@ -1131,9 +1131,9 @@ class Enum(String, SchemaType): import enum class MyEnum(enum.Enum): - one = "one" - two = "two" - three = "three" + one = 1 + two = 2 + three = 3 t = Table( @@ -1144,6 +1144,11 @@ class Enum(String, SchemaType): connection.execute(t.insert(), {"value": MyEnum.two}) assert connection.scalar(t.select()) is MyEnum.two + Above, the string names of each element, e.g. "one", "two", "three", + are persisted to the database; the values of the Python Enum, here + indicated as integers, are **not** used; the value of each enum can + therefore be any kind of Python object whether or not it is persistable. + .. versionadded:: 1.1 - support for PEP-435-style enumerated classes. |
