From a926dea6b78c91b627f0f0b86cdc6a9279872e99 Mon Sep 17 00:00:00 2001 From: petit87 Date: Sat, 26 Feb 2022 16:46:32 -0500 Subject: Fix repr for MySQL SET, generic Enum Fixed issues in :class:`_mysql.SET` datatype as well as :class:`.Enum` where the ``__repr__()`` method would not render all optional parameters in the string output, impacting the use of these types in Alembic autogenerate. Pull request for MySQL courtesy Yuki Nishimine. Fixes: #7720 Fixes: #7789 Closes: #7772 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/7772 Pull-request-sha: d58845479f497f6b2e12d7df2e9eb2d6ac22109b Co-authored-by: Mike Bayer Change-Id: Idcec23eab4258511d9f32f4e3d78e511ea6021f1 --- lib/sqlalchemy/sql/sqltypes.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/sqlalchemy/sql') diff --git a/lib/sqlalchemy/sql/sqltypes.py b/lib/sqlalchemy/sql/sqltypes.py index d022a24ca..3794fd8f7 100644 --- a/lib/sqlalchemy/sql/sqltypes.py +++ b/lib/sqlalchemy/sql/sqltypes.py @@ -1453,7 +1453,10 @@ class Enum(Emulated, String, TypeEngine[Union[str, enum.Enum]], SchemaType): def __repr__(self): return util.generic_repr( self, - additional_kw=[("native_enum", True)], + additional_kw=[ + ("native_enum", True), + ("create_constraint", False), + ], to_inspect=[Enum, SchemaType], ) -- cgit v1.2.1