diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-07-14 10:29:50 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-07-14 13:28:25 -0400 |
| commit | 79a3dafb1425488ba29d309cc32e0e24004be256 (patch) | |
| tree | 19edb827f4d3bbed2a686c46cf24adee0db232fd /lib/sqlalchemy/sql | |
| parent | ac5ccb7e8560832beb8ec5fdeaab90816cb05973 (diff) | |
| download | sqlalchemy-79a3dafb1425488ba29d309cc32e0e24004be256.tar.gz | |
Ensure alias traversal block works when adapt_from_selectables present
Fixed regression which appeared in version 1.4.3 due to :ticket:`6060`
where rules that limit ORM adaptation of derived selectables interfered
with other ORM-adaptation based cases, in this case when applying
adaptations for a :func:`_orm.with_polymorphic` against a mapping which
uses a :func:`_orm.column_property` which in turn makes use of a scalar
select that includes a :func:`_orm.aliased` object of the mapped table.
Fixes: #6762
Change-Id: Ice3dc34b97d12b59f044bdc0c5faaefcc4015227
Diffstat (limited to 'lib/sqlalchemy/sql')
| -rw-r--r-- | lib/sqlalchemy/sql/compiler.py | 1 | ||||
| -rw-r--r-- | lib/sqlalchemy/sql/util.py | 12 |
2 files changed, 6 insertions, 7 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index b9f55b746..29ef8047e 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -1414,7 +1414,6 @@ class SQLCompiler(Compiled): (label, labelname) + label._alt_names + result_map_targets, label.type, ) - return ( label.element._compiler_dispatch( self, diff --git a/lib/sqlalchemy/sql/util.py b/lib/sqlalchemy/sql/util.py index 456469941..da5e31655 100644 --- a/lib/sqlalchemy/sql/util.py +++ b/lib/sqlalchemy/sql/util.py @@ -853,14 +853,14 @@ class ClauseAdapter(visitors.ReplacingExternalTraversal): if isinstance(col, FromClause) and not isinstance( col, functions.FunctionElement ): - if self.adapt_from_selectables: - for adp in self.adapt_from_selectables: - if adp.is_derived_from(col): - break - else: - return None if self.selectable.is_derived_from(col): + if self.adapt_from_selectables: + for adp in self.adapt_from_selectables: + if adp.is_derived_from(col): + break + else: + return None return self.selectable elif isinstance(col, Alias) and isinstance( col.element, TableClause |
