From a7a8804a836ce9edcfdee7d7406cd3c050b34f05 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 6 Dec 2019 10:24:25 -0500 Subject: Include DISTINCT in error message for label reference Needed to add tests to ensure this label reference is handled correctly, so also modified the exception message to be more clear if someone has this error within distinct(). Change-Id: I6e685e46ae336596272d14366445ac224c18d92c --- lib/sqlalchemy/sql/compiler.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/sqlalchemy/sql') diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index 85c1750b7..a28ce465a 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -811,7 +811,10 @@ class SQLCompiler(Compiled): except KeyError: coercions._no_text_coercion( element.element, - extra="Can't resolve label reference for ORDER BY / GROUP BY.", + extra=( + "Can't resolve label reference for ORDER BY / " + "GROUP BY / DISTINCT etc." + ), exc_cls=exc.CompileError, ) else: -- cgit v1.2.1