summaryrefslogtreecommitdiff
path: root/test/sql/test_compiler.py
diff options
context:
space:
mode:
authorFederico Caselli <cfederico87@gmail.com>2020-04-16 23:16:32 +0200
committerMike Bayer <mike_mp@zzzcomputing.com>2020-04-20 11:28:51 -0400
commit07d6d211f23f1d9d1d69fd54e8054bccd515bc8c (patch)
tree321a19e49f8918ec38bba96bf4c062633801bd26 /test/sql/test_compiler.py
parent2f617f56f2acdce00b88f746c403cf5ed66d4d27 (diff)
downloadsqlalchemy-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 'test/sql/test_compiler.py')
-rw-r--r--test/sql/test_compiler.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/sql/test_compiler.py b/test/sql/test_compiler.py
index e44deed90..440eaa05a 100644
--- a/test/sql/test_compiler.py
+++ b/test/sql/test_compiler.py
@@ -1462,6 +1462,13 @@ class SelectTest(fixtures.TestBase, AssertsCompiledSQL):
"SELECT count(DISTINCT mytable.myid) AS count_1 FROM mytable",
)
+ def test_distinct_on(self):
+ with testing.expect_deprecated(
+ "DISTINCT ON is currently supported only by the PostgreSQL "
+ "dialect"
+ ):
+ select(["*"]).distinct(table1.c.myid).compile()
+
def test_where_empty(self):
self.assert_compile(
select([table1.c.myid]).where(