summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/elements.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2019-07-02 18:16:38 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2019-07-02 18:16:38 -0400
commit9b52c8ae927ae2628dcc1763d2e31245285f4d88 (patch)
tree9294132311ec8bd72a4247bef033ea0cef97b366 /lib/sqlalchemy/sql/elements.py
parent6636cd9d256ccbad651eba6553ec46391380cc93 (diff)
downloadsqlalchemy-9b52c8ae927ae2628dcc1763d2e31245285f4d88.tar.gz
Rework proxy_cache fix to restore performance
Adjustment to the fix made in I7fb134cac3604f8fe62e220fb24a0945d0a1c56f. Fixes: #4747 Change-Id: I2f1010b0abc1faa892f5e346e58f9c4a3867622f
Diffstat (limited to 'lib/sqlalchemy/sql/elements.py')
-rw-r--r--lib/sqlalchemy/sql/elements.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/sqlalchemy/sql/elements.py b/lib/sqlalchemy/sql/elements.py
index aa7b7f688..22799dab5 100644
--- a/lib/sqlalchemy/sql/elements.py
+++ b/lib/sqlalchemy/sql/elements.py
@@ -793,6 +793,18 @@ class ColumnElement(
s.update(c.proxy_set)
return s
+ def _uncached_proxy_set(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])
+ for c in self._proxies:
+ s.update(c._uncached_proxy_set())
+ return s
+
def shares_lineage(self, othercolumn):
"""Return True if the given :class:`.ColumnElement`
has a common ancestor to this :class:`.ColumnElement`."""
@@ -4386,8 +4398,6 @@ class AnnotatedColumnElement(Annotated):
def __init__(self, element, values):
Annotated.__init__(self, element, values)
ColumnElement.comparator._reset(self)
- if self._proxies:
- ColumnElement.proxy_set._reset(self)
for attr in ("name", "key", "table"):
if self.__dict__.get(attr, False) is None:
self.__dict__.pop(attr)