The TypeDecorator.cache_ok class-level flag indicates if this custom TypeDecorator is safe to be used as part of a cache key. This flag defaults to None which will initially generate a warning when the SQL compiler attempts to generate a cache key for a statement that uses this type. If the TypeDecorator is not guaranteed to produce the same bind/result behavior and SQL generation every time, this flag should be set to False; otherwise if the class produces the same behavior each time, it may be set to True. See TypeDecorator.cache_ok for further notes on how this works. As I don't know if those can be safely cached, just disable the warning. Index: mailman-3.3.5/src/mailman/database/types.py =================================================================== --- mailman-3.3.5.orig/src/mailman/database/types.py 2021-09-06 02:19:59.000000000 +0200 +++ mailman-3.3.5/src/mailman/database/types.py 2022-06-23 08:57:19.527825754 +0200 @@ -34,6 +34,7 @@ class Enum(TypeDecorator): converts it on-the-fly. """ impl = Integer + cache_ok = False def __init__(self, enum, *args, **kw): super().__init__(*args, **kw) @@ -59,6 +60,7 @@ class UUID(TypeDecorator): """ impl = CHAR + cache_ok = False def load_dialect_impl(self, dialect): if dialect.name == 'postgresql': @@ -97,6 +99,7 @@ class SAUnicode(TypeDecorator): column needs to be indexed, otherwise use SAUnicode4Byte. """ impl = Unicode + cache_ok = False @compiles(SAUnicode) @@ -120,6 +123,7 @@ class SAUnicode4Byte(TypeDecorator): type and it can still be used if needed in the codebase. """ impl = Unicode + cache_ok = False @compiles(SAUnicode4Byte) @@ -140,6 +144,7 @@ class SAUnicodeLarge(TypeDecorator): This is double size of SAUnicode defined above. """ impl = Unicode + cache_ok = False @compiles(SAUnicodeLarge, 'mysql') @@ -166,6 +171,7 @@ class SAUnicodeXL(TypeDecorator): See https://docs.sqlalchemy.org/en/latest/dialects/mysql.html#index-length """ impl = Unicode + cache_ok = False @compiles(SAUnicodeXL, 'mysql') @@ -187,6 +193,7 @@ class SAText(TypeDecorator): case of other dialects defaults to the Text type. """ impl = Text + cache_ok = False @compiles(SAText)