diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-11-14 13:18:45 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-11-14 13:43:02 -0500 |
| commit | bf6adda95461d4c3c2076d39850df2403a157662 (patch) | |
| tree | dc4f6249aa96b85dfb6bcb9626c75b27bbd98dc1 /lib | |
| parent | 3d892381996e7ba68ee3bf6d7de40c8414e3812a (diff) | |
| download | sqlalchemy-bf6adda95461d4c3c2076d39850df2403a157662.tar.gz | |
avoid putting annotated columns in sets
backporting a small bit of the changes made for the
2.0 version of #8796.
See if the changes apply cleanly to the 1.4 branch.
Fixes: #8796
Change-Id: I8118511a10beb38c545a55c962a18a77611293af
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/sqlalchemy/sql/base.py | 4 | ||||
| -rw-r--r-- | lib/sqlalchemy/sql/elements.py | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/sqlalchemy/sql/base.py b/lib/sqlalchemy/sql/base.py index ec685d1fa..4519e649b 100644 --- a/lib/sqlalchemy/sql/base.py +++ b/lib/sqlalchemy/sql/base.py @@ -1430,7 +1430,7 @@ class ColumnCollection(object): operator.add, [ sc._annotations.get("weight", 1) - for sc in col._uncached_proxy_set() + for sc in col._uncached_proxy_list() if sc.shares_lineage(column) ], ) @@ -1438,7 +1438,7 @@ class ColumnCollection(object): operator.add, [ sc._annotations.get("weight", 1) - for sc in c._uncached_proxy_set() + for sc in c._uncached_proxy_list() if sc.shares_lineage(column) ], ) diff --git a/lib/sqlalchemy/sql/elements.py b/lib/sqlalchemy/sql/elements.py index 72486e749..d438e5995 100644 --- a/lib/sqlalchemy/sql/elements.py +++ b/lib/sqlalchemy/sql/elements.py @@ -902,21 +902,21 @@ class ColumnElement( @util.memoized_property def proxy_set(self): - s = util.column_set([self]) + s = util.column_set([self._deannotate()]) for c in self._proxies: s.update(c.proxy_set) return s - def _uncached_proxy_set(self): + def _uncached_proxy_list(self): """An 'uncached' version of proxy set. This is so that we can read annotations from the list of columns without breaking the caching of the above proxy_set. """ - s = util.column_set([self]) + s = [self] for c in self._proxies: - s.update(c._uncached_proxy_set()) + s.extend(c._uncached_proxy_list()) return s def shares_lineage(self, othercolumn): |
