diff options
Diffstat (limited to 'lib/sqlalchemy/orm/util.py')
-rw-r--r-- | lib/sqlalchemy/orm/util.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/sqlalchemy/orm/util.py b/lib/sqlalchemy/orm/util.py index 6cd98f5ea..e5bdbaa4f 100644 --- a/lib/sqlalchemy/orm/util.py +++ b/lib/sqlalchemy/orm/util.py @@ -1011,7 +1011,7 @@ class AliasedInsp( our_classes = util.to_set( mp.class_ for mp in self.with_polymorphic_mappers ) - new_classes = set([mp.class_ for mp in other.with_polymorphic_mappers]) + new_classes = {mp.class_ for mp in other.with_polymorphic_mappers} if our_classes == new_classes: return other else: @@ -1278,8 +1278,7 @@ class LoaderCriteriaOption(CriteriaOption): def _all_mappers(self) -> Iterator[Mapper[Any]]: if self.entity: - for mp_ent in self.entity.mapper.self_and_descendants: - yield mp_ent + yield from self.entity.mapper.self_and_descendants else: assert self.root_entity stack = list(self.root_entity.__subclasses__()) @@ -1290,8 +1289,7 @@ class LoaderCriteriaOption(CriteriaOption): inspection.inspect(subclass, raiseerr=False), ) if ent: - for mp in ent.mapper.self_and_descendants: - yield mp + yield from ent.mapper.self_and_descendants else: stack.extend(subclass.__subclasses__()) @@ -1317,7 +1315,10 @@ class LoaderCriteriaOption(CriteriaOption): crit = self.where_criteria # type: ignore assert isinstance(crit, ColumnElement) return sql_util._deep_annotate( - crit, {"for_loader_criteria": self}, detect_subquery_cols=True + crit, + {"for_loader_criteria": self}, + detect_subquery_cols=True, + ind_cols_on_fromclause=True, ) def process_compile_state_replaced_entities( @@ -1416,6 +1417,8 @@ class Bundle( _propagate_attrs: _PropagateAttrsType = util.immutabledict() + proxy_set = util.EMPTY_SET # type: ignore + exprs: List[_ColumnsClauseElement] def __init__( |