]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Add ``omit_aliases`` in ``Enum``.
authorFederico Caselli <cfederico87@gmail.com>
Mon, 29 Mar 2021 20:30:49 +0000 (22:30 +0200)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 1 Apr 2021 22:55:37 +0000 (18:55 -0400)
commit1f31c6f36ab6dabb4696de609e9f07225b46cc13
treefa0d304c0e18d1850bbd64abc2a4d7736209c14d
parent3a29d65f73c6e705f486588068172d45017285fa
Add ``omit_aliases`` in ``Enum``.

Introduce a new parameter :paramref:`_types.Enum.omit_aliases` in
:class:`_types.Enum` type allow filtering aliases when using a pep435 Enum.
Previous versions of SQLAlchemy kept aliases in all cases, creating
database enum type with additional states, meaning that they were treated
as different values in the db. For backward compatibility this flag
defaults to ``False`` in the 1.4 series, but will be switched to ``True``
in a future version. A deprecation warning is raise if this flag is not
specified and the passed enum contains aliases.

Fixes: #6146
Change-Id: I547322ffa90d0273d91bb3bf8bfea6ec934d48b9
doc/build/changelog/unreleased_14/6146.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/mysql/enumerated.py
lib/sqlalchemy/dialects/postgresql/base.py
lib/sqlalchemy/sql/sqltypes.py
test/sql/test_types.py