summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/lambdas.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2020-12-11 19:01:12 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2020-12-11 22:01:57 -0500
commited20e2f95f52a072d0c6b09af095b4cda0436d38 (patch)
tree340571f1d5bce61f5126a932a7739fee7efb3b77 /lib/sqlalchemy/sql/lambdas.py
parent8e9e473dcb76b57a7f0eaa476481cb66a258ea69 (diff)
downloadsqlalchemy-ed20e2f95f52a072d0c6b09af095b4cda0436d38.tar.gz
Fixes for lambda expressions and relationship loaders
Fixed bug in lambda SQL feature, used by ORM :meth:`_orm.with_loader_criteria` as well as available generally in the SQL expression language, where assigning a boolean value True/False to a variable would cause the query-time expression calculation to fail, as it would produce a SQL expression not compatible with a bound value. Fixed issue where the :attr:`_orm.ORMExecuteState.is_relationship_load` parameter would not be set correctly for many lazy loads, all selectinloads, etc. The flag is essential in order to test if options should be added to statements or if they would already have been propagated via relationship loads. Fixes: #5763 Fixes: #5764 Change-Id: I66aafbef193f892ff75ede0670698647b7475482
Diffstat (limited to 'lib/sqlalchemy/sql/lambdas.py')
-rw-r--r--lib/sqlalchemy/sql/lambdas.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/sqlalchemy/sql/lambdas.py b/lib/sqlalchemy/sql/lambdas.py
index 676152781..aafdda4ce 100644
--- a/lib/sqlalchemy/sql/lambdas.py
+++ b/lib/sqlalchemy/sql/lambdas.py
@@ -1021,7 +1021,12 @@ class PyWrapper(ColumnOperators):
def __getattribute__(self, key):
if key.startswith("_sa_"):
return object.__getattribute__(self, key[4:])
- elif key in ("__clause_element__", "operate", "reverse_operate"):
+ elif key in (
+ "__clause_element__",
+ "operate",
+ "reverse_operate",
+ "__class__",
+ ):
return object.__getattribute__(self, key)
if key.startswith("__"):