summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/compiler.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2021-04-16 11:06:56 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2021-04-17 00:40:52 -0400
commit9f758d7fe328107cd3d047b8c999dce228a570d1 (patch)
tree9867a6dbdf81d5111907e4a49c86d6e06488f0c9 /lib/sqlalchemy/sql/compiler.py
parentb3d764fa768756cd7aef73253ccceac456c76c81 (diff)
downloadsqlalchemy-9f758d7fe328107cd3d047b8c999dce228a570d1.tar.gz
Don't stringify unnamed column elements when proxying
Repaired and solidified issues regarding custom functions and other arbitrary expression constructs which within SQLAlchemy's column labeling mechanics would seek to use ``str(obj)`` to get a string representation to use as an anonymous column name in the ``.c`` collection of a subquery. This is a very legacy behavior that performs poorly and leads to lots of issues, so has been revised to no longer perform any compilation by establishing specific methods on :class:`.FunctionElement` to handle this case, as SQL functions are the only use case that it came into play. An effect of this behavior is that an unlabeled column expression with no derivable name will be given an arbitrary label starting with the prefix ``"_no_label"`` in the ``.c`` collection of a subquery; these were previously being represented either as the generic stringification of that expression, or as an internal symbol. This change seeks to make the concept of "anon name" more private and renames anon_label and anon_key_label to _anon_name_label and _anon_key_label. There's no end-user utility to these accessors and we need to be able to reorganize these as well. Fixes: #6256 Change-Id: Ie63c86b20ca45873affea78500388da94cf8bf94
Diffstat (limited to 'lib/sqlalchemy/sql/compiler.py')
-rw-r--r--lib/sqlalchemy/sql/compiler.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py
index 0c701cb52..dd889781e 100644
--- a/lib/sqlalchemy/sql/compiler.py
+++ b/lib/sqlalchemy/sql/compiler.py
@@ -2872,7 +2872,7 @@ class SQLCompiler(Compiled):
):
result_expr = _CompileLabel(
col_expr,
- column.anon_label
+ column._anon_name_label
if not column_is_repeated
else column._dedupe_label_anon_label,
)