summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/postgresql/asyncpg.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2021-11-17 15:08:29 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2021-11-17 15:55:12 -0500
commit4761e6878b127f7d5fb09addaae15426edbb0b73 (patch)
tree3b28ab7de038b7933df91b43856ebdc55cef6d29 /lib/sqlalchemy/dialects/postgresql/asyncpg.py
parent958f902b1fc528fed0be550bc573545de47ed854 (diff)
downloadsqlalchemy-4761e6878b127f7d5fb09addaae15426edbb0b73.tar.gz
generalize cache_ok to UserDefinedType
Extended the ``cache_ok`` flag and corresponding warning message if this flag is not defined, a behavior first established for :class:`.TypeDecorator` as part of :ticket:`6436`, to also take place for :class:`.UserDefinedType`, by generalizing the flag and associated caching logic to a new common base for these two types, :class:`.ExternalType`. The change means any current :class:`.UserDefinedType` will now cause SQL statement caching to no longer take place for statements which make use of the datatype, along with a warning being emitted, unless the class defines the :attr:`.UserDefinedType.cache_ok` flag as True. If the datatype cannot form a deterministic, hashable cache key derived from its arguments, it may return False which will continue to keep caching disabled but will suppress the warning. In particular, custom datatypes currently used in packages such as SQLAlchemy-utils will need to implement this flag. The issue was observed as a result of a SQLAlchemy-utils datatype that is not currently cacheable. Fixes: #7319 Change-Id: Ie0b5d4587df87bfe66d2fe7cd4585c3882584575
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql/asyncpg.py')
0 files changed, 0 insertions, 0 deletions