From 07d6d211f23f1d9d1d69fd54e8054bccd515bc8c Mon Sep 17 00:00:00 2001 From: Federico Caselli Date: Thu, 16 Apr 2020 23:16:32 +0200 Subject: Deprecate ``DISTINCT ON`` when not targeting PostgreSQL Deprecate usage of ``DISTINCT ON`` in dialect other than PostgreSQL. Previously this was silently ignored. Deprecate old usage of string distinct in MySQL dialect Fixes: #4002 Change-Id: I38fc64aef75e77748083c11d388ec831f161c9c9 --- lib/sqlalchemy/dialects/postgresql/base.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/sqlalchemy/dialects/postgresql/base.py') diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py index 20540ac02..ca2f6a8a4 100644 --- a/lib/sqlalchemy/dialects/postgresql/base.py +++ b/lib/sqlalchemy/dialects/postgresql/base.py @@ -1693,6 +1693,8 @@ class PGCompiler(compiler.SQLCompiler): return "ONLY " + sqltext def get_select_precolumns(self, select, **kw): + # Do not call super().get_select_precolumns because + # it will warn/raise when distinct on is present if select._distinct or select._distinct_on: if select._distinct_on: return ( -- cgit v1.2.1