diff options
author | Federico Caselli <cfederico87@gmail.com> | 2020-04-16 23:16:32 +0200 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-04-20 11:28:51 -0400 |
commit | 07d6d211f23f1d9d1d69fd54e8054bccd515bc8c (patch) | |
tree | 321a19e49f8918ec38bba96bf4c062633801bd26 /lib/sqlalchemy/dialects/mssql/base.py | |
parent | 2f617f56f2acdce00b88f746c403cf5ed66d4d27 (diff) | |
download | sqlalchemy-07d6d211f23f1d9d1d69fd54e8054bccd515bc8c.tar.gz |
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
Diffstat (limited to 'lib/sqlalchemy/dialects/mssql/base.py')
-rw-r--r-- | lib/sqlalchemy/dialects/mssql/base.py | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/lib/sqlalchemy/dialects/mssql/base.py b/lib/sqlalchemy/dialects/mssql/base.py index df6196bae..0dd2ac11b 100644 --- a/lib/sqlalchemy/dialects/mssql/base.py +++ b/lib/sqlalchemy/dialects/mssql/base.py @@ -1636,9 +1636,7 @@ class MSSQLCompiler(compiler.SQLCompiler): def get_select_precolumns(self, select, **kw): """ MS-SQL puts TOP, it's version of LIMIT here """ - s = "" - if select._distinct: - s += "DISTINCT " + s = super(MSSQLCompiler, self).get_select_precolumns(select, **kw) if select._simple_int_limit and ( select._offset_clause is None @@ -1649,12 +1647,8 @@ class MSSQLCompiler(compiler.SQLCompiler): # so have to use literal here. kw["literal_execute"] = True s += "TOP %s " % self.process(select._limit_clause, **kw) - if s: - return s - else: - return compiler.SQLCompiler.get_select_precolumns( - self, select, **kw - ) + + return s def get_from_hint_text(self, table, text): return text |