From 0210695bd97e76f58d8781b69337816501482fb0 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 26 Feb 2016 00:20:39 -0500 Subject: - Anonymous labeling is applied to a :attr:`.func` construct that is passed to :func:`.column_property`, so that if the same attribute is referred to as a column expression twice the names are de-duped, thus avoiding "ambiguous column" errors. Previously, the ``.label(None)`` would need to be applied in order for the name to be de-anonymized. fixes #3663 --- lib/sqlalchemy/sql/elements.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/sqlalchemy/sql') diff --git a/lib/sqlalchemy/sql/elements.py b/lib/sqlalchemy/sql/elements.py index ca822d310..67a442b0c 100644 --- a/lib/sqlalchemy/sql/elements.py +++ b/lib/sqlalchemy/sql/elements.py @@ -4006,7 +4006,7 @@ def _cloned_difference(a, b): def _labeled(element): - if not hasattr(element, 'name'): + if not hasattr(element, 'name') or not getattr(element, '_label', None): return element.label(None) else: return element -- cgit v1.2.1