summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/mysql/enumerated.py
diff options
context:
space:
mode:
authorpetit87 <west12capri12@gmail.com>2022-02-26 16:46:32 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2022-03-04 13:01:20 -0500
commita926dea6b78c91b627f0f0b86cdc6a9279872e99 (patch)
tree59dae06cc4f29343da0a95a4709dcc1bd8dd4000 /lib/sqlalchemy/dialects/mysql/enumerated.py
parent9e7c068d669b209713da62da5748579f92d98129 (diff)
downloadsqlalchemy-a926dea6b78c91b627f0f0b86cdc6a9279872e99.tar.gz
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 <mike_mp@zzzcomputing.com> Change-Id: Idcec23eab4258511d9f32f4e3d78e511ea6021f1
Diffstat (limited to 'lib/sqlalchemy/dialects/mysql/enumerated.py')
-rw-r--r--lib/sqlalchemy/dialects/mysql/enumerated.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/sqlalchemy/dialects/mysql/enumerated.py b/lib/sqlalchemy/dialects/mysql/enumerated.py
index 875858871..c35b7226d 100644
--- a/lib/sqlalchemy/dialects/mysql/enumerated.py
+++ b/lib/sqlalchemy/dialects/mysql/enumerated.py
@@ -233,3 +233,12 @@ class SET(_StringType):
def adapt(self, impltype, **kw):
kw["retrieve_as_bitwise"] = self.retrieve_as_bitwise
return util.constructor_copy(self, impltype, *self.values, **kw)
+
+ def __repr__(self):
+ return util.generic_repr(
+ self,
+ to_inspect=[SET, _StringType],
+ additional_kw=[
+ ("retrieve_as_bitwise", False),
+ ],
+ )