summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/attributes.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2021-12-09 12:51:43 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2021-12-09 12:51:43 -0500
commit546391e5a80f647e7ad78ef93f832f10278a8867 (patch)
tree1d67ee82fbc7aeeaa69c061f7d881415c814a66f /lib/sqlalchemy/orm/attributes.py
parentaf50c8064d668ba33ef2399a288fd1594b1b5602 (diff)
downloadsqlalchemy-546391e5a80f647e7ad78ef93f832f10278a8867.tar.gz
implement attributes.Proxy._clone()
Fixed issue where the internal cloning used by the :meth:`_orm.PropComparator.any` method on a :func:`_orm.relationship` in the case where the related class also makes use of ORM polymorphic loading, would fail if a hybrid property on the related, polymorphic class were used within the criteria for the ``any()`` operation. Fixes: #7425 Change-Id: I5f4f4ec5fab17df228bc6e3de412d24114b20600
Diffstat (limited to 'lib/sqlalchemy/orm/attributes.py')
-rw-r--r--lib/sqlalchemy/orm/attributes.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/attributes.py b/lib/sqlalchemy/orm/attributes.py
index b66d55250..bf8d69b4e 100644
--- a/lib/sqlalchemy/orm/attributes.py
+++ b/lib/sqlalchemy/orm/attributes.py
@@ -571,6 +571,16 @@ def create_proxied_attribute(descriptor):
adapt_to_entity,
)
+ def _clone(self, **kw):
+ return self.__class__(
+ self.class_,
+ self.key,
+ self.descriptor,
+ self._comparator,
+ adapt_to_entity=self._adapt_to_entity,
+ original_property=self.original_property,
+ )
+
def __get__(self, instance, owner):
retval = self.descriptor.__get__(instance, owner)
# detect if this is a plain Python @property, which just returns