summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
authormike bayer <mike_mp@zzzcomputing.com>2021-10-27 15:56:16 +0000
committerGerrit Code Review <gerrit@ci3.zzzcomputing.com>2021-10-27 15:56:16 +0000
commit5a334c9a66ad83619ee6ff3dbfa5352840e76d2f (patch)
treeac1649c4c3ddc9db4f41dedf843116df63147e78 /lib/sqlalchemy
parent0a57293b844e2164d8a71f6dcfe182bfa0732460 (diff)
parent5ad4190aa428dabc571e3d9c0e6a7944a384c8c3 (diff)
downloadsqlalchemy-5a334c9a66ad83619ee6ff3dbfa5352840e76d2f.tar.gz
Merge "consider "inspect(_of_type)" to be the entity of a comparator" into main
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r--lib/sqlalchemy/orm/interfaces.py5
-rw-r--r--lib/sqlalchemy/orm/relationships.py8
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/sqlalchemy/orm/interfaces.py b/lib/sqlalchemy/orm/interfaces.py
index 903672c80..9eb362c43 100644
--- a/lib/sqlalchemy/orm/interfaces.py
+++ b/lib/sqlalchemy/orm/interfaces.py
@@ -475,7 +475,8 @@ class PropComparator(operators.ColumnOperators):
def of_type(self, class_):
r"""Redefine this object in terms of a polymorphic subclass,
- :func:`.with_polymorphic` construct, or :func:`.aliased` construct.
+ :func:`_orm.with_polymorphic` construct, or :func:`_orm.aliased`
+ construct.
Returns a new PropComparator from which further criterion can be
evaluated.
@@ -490,6 +491,8 @@ class PropComparator(operators.ColumnOperators):
.. seealso::
+ :ref:`queryguide_join_onclause` - in the :ref:`queryguide_toplevel`
+
:ref:`inheritance_of_type`
"""
diff --git a/lib/sqlalchemy/orm/relationships.py b/lib/sqlalchemy/orm/relationships.py
index 3916c0a83..d021ac9a2 100644
--- a/lib/sqlalchemy/orm/relationships.py
+++ b/lib/sqlalchemy/orm/relationships.py
@@ -1161,7 +1161,13 @@ class RelationshipProperty(StrategizedProperty):
:func:`_orm.relationship`.
"""
- return self.property.entity
+ # this is a relatively recent change made for
+ # 1.4.27 as part of #7244.
+ # TODO: shouldn't _of_type be inspected up front when received?
+ if self._of_type is not None:
+ return inspect(self._of_type)
+ else:
+ return self.property.entity
@util.memoized_property
def mapper(self):