From e67d1b79c544c14f375dff90b5d8af5b472c053e Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 19 Mar 2021 01:18:06 -0400 Subject: Deannoate functions before matching .__class__ Fixed regression where the SQL compilation of a :class:`.Function` would not work correctly if the object had been "annotated", which is an internal memoization process used mostly by the ORM. In particular it could affect ORM lazy loads which make greater use of this feature in 1.4. Fixes: #6095 Change-Id: I7a6527df651f440a04d911ba78ee0b0dd4436dcd --- lib/sqlalchemy/sql/compiler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/sqlalchemy/sql') diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index 0ea251fb4..276209103 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -1720,7 +1720,7 @@ class SQLCompiler(Compiled): if disp: text = disp(func, **kwargs) else: - name = FUNCTIONS.get(func.__class__, None) + name = FUNCTIONS.get(func._deannotate().__class__, None) if name: if func._has_args: name += "%(expr)s" -- cgit v1.2.1