summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/elements.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2021-10-18 16:35:21 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2021-10-20 11:12:39 -0400
commitb961505986c0499ba63a0105d1b79aaa6db738a0 (patch)
tree56411840c68bd89f2e81a81e4c75eaf4d1f583b0 /lib/sqlalchemy/sql/elements.py
parent4bad8b5a7f48d571bd1e96908299134830ff462f (diff)
downloadsqlalchemy-b961505986c0499ba63a0105d1b79aaa6db738a0.tar.gz
remove _resolve_label and related attributes
these seem to date back to 0.9 and revs like #3148 but none of it seems to be affecting things now, try removing it all and seeing what fails. we've noted that _resolve_label does not appear to be needed, however allow_label_resolve remains relevant both for non-column elements like text() as well as that it is used explicitly by the joined eager loader. Change-Id: Ic8a5d8001ef2a4133360f51a92a6f7b0cc389095
Diffstat (limited to 'lib/sqlalchemy/sql/elements.py')
-rw-r--r--lib/sqlalchemy/sql/elements.py25
1 files changed, 6 insertions, 19 deletions
diff --git a/lib/sqlalchemy/sql/elements.py b/lib/sqlalchemy/sql/elements.py
index ae105428c..e883454de 100644
--- a/lib/sqlalchemy/sql/elements.py
+++ b/lib/sqlalchemy/sql/elements.py
@@ -790,23 +790,14 @@ class ColumnElement(
"""
- _resolve_label = None
- """The name that should be used to identify this ColumnElement in a
- select() object when "label resolution" logic is used; this refers
- to using a string name in an expression like order_by() or group_by()
- that wishes to target a labeled expression in the columns clause.
+ _allow_label_resolve = True
+ """A flag that can be flipped to prevent a column from being resolvable
+ by string label name.
- The name is distinct from that of .name or ._label to account for the case
- where anonymizing logic may be used to change the name that's actually
- rendered at compile time; this attribute should hold onto the original
- name that was user-assigned when producing a .label() construct.
+ The joined eager loader strategy in the ORM uses this, for example.
"""
- _allow_label_resolve = True
- """A flag that can be flipped to prevent a column from being resolvable
- by string label name."""
-
_is_implicitly_boolean = False
_alt_names = ()
@@ -1783,7 +1774,7 @@ class TextClause(
# help in those cases where text() is
# interpreted in a column expression situation
- key = _label = _resolve_label = None
+ key = _label = None
_allow_label_resolve = False
@@ -4533,10 +4524,6 @@ class Label(roles.LabeledColumnExprRole, ColumnElement):
if name:
self.name = name
-
- # TODO: nothing fails if this is removed. this is related
- # to the order_by() string feature tested in test_text.py.
- self._resolve_label = self.name
else:
self.name = _anonymous_label.safe_construct(
id(self), getattr(element, "name", "anon")
@@ -4601,7 +4588,7 @@ class Label(roles.LabeledColumnExprRole, ColumnElement):
self._reset_memoizations()
self._element = clone(self._element, **kw)
if anonymize_labels:
- self.name = self._resolve_label = _anonymous_label.safe_construct(
+ self.name = _anonymous_label.safe_construct(
id(self), getattr(self.element, "name", "anon")
)
self.key = self._tq_label = self._tq_key_label = self.name