From 926952c4afe0b2e16c4a74f05958bded7b932760 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 6 Dec 2019 11:38:55 -0500 Subject: Use label reference coercion for select() distinct keyword argument Fixed bug where "distinct" keyword passed to :func:`.select` would not treat a string value as a "label reference" in the same way that the :meth:`.select.distinct` does; it would instead raise unconditionally. This keyword argument and the others passed to :func:`.select` will ultimately be deprecated for SQLAlchemy 2.0. Fixes: #5028 Change-Id: Id36cfe477ed836c3248824ce1b81d0016dbe99f4 --- lib/sqlalchemy/sql/selectable.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/sqlalchemy/sql') diff --git a/lib/sqlalchemy/sql/selectable.py b/lib/sqlalchemy/sql/selectable.py index 4b3844eec..0eadab610 100644 --- a/lib/sqlalchemy/sql/selectable.py +++ b/lib/sqlalchemy/sql/selectable.py @@ -3388,7 +3388,7 @@ class Select( if not isinstance(distinct, bool): self._distinct_on = tuple( [ - coercions.expect(roles.WhereHavingRole, e) + coercions.expect(roles.ByOfRole, e) for e in util.to_list(distinct) ] ) -- cgit v1.2.1