diff options
| author | mike bayer <mike_mp@zzzcomputing.com> | 2020-04-20 17:15:54 +0000 |
|---|---|---|
| committer | Gerrit Code Review <gerrit@bbpush.zzzcomputing.com> | 2020-04-20 17:15:54 +0000 |
| commit | f911e191d69e649ef8280309be9b0bb4d414d53d (patch) | |
| tree | 26516fd09ed7d8db44902f59039b340cf60d600b /lib/sqlalchemy/testing/suite | |
| parent | e1a87f00123f97a6342af96ccc4b10a3ac51807e (diff) | |
| parent | 07d6d211f23f1d9d1d69fd54e8054bccd515bc8c (diff) | |
| download | sqlalchemy-f911e191d69e649ef8280309be9b0bb4d414d53d.tar.gz | |
Merge "Deprecate ``DISTINCT ON`` when not targeting PostgreSQL"
Diffstat (limited to 'lib/sqlalchemy/testing/suite')
| -rw-r--r-- | lib/sqlalchemy/testing/suite/test_select.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/sqlalchemy/testing/suite/test_select.py b/lib/sqlalchemy/testing/suite/test_select.py index c1f77a7c1..ad17ebb4a 100644 --- a/lib/sqlalchemy/testing/suite/test_select.py +++ b/lib/sqlalchemy/testing/suite/test_select.py @@ -12,6 +12,7 @@ from ..schema import Column from ..schema import Table from ... import bindparam from ... import case +from ... import column from ... import Computed from ... import false from ... import func @@ -20,6 +21,7 @@ from ... import literal_column from ... import null from ... import select from ... import String +from ... import table from ... import testing from ... import text from ... import true @@ -1016,6 +1018,19 @@ class ComputedColumnTest(fixtures.TablesTest): eq_(res, [(100, 40), (1764, 168)]) +class DistinctOnTest(AssertsCompiledSQL, fixtures.TablesTest): + __backend__ = True + __requires__ = ("standard_cursor_sql",) + + @testing.fails_if(testing.requires.supports_distinct_on) + def test_distinct_on(self): + stm = select(["*"]).distinct(column("q")).select_from(table("foo")) + with testing.expect_deprecated( + "DISTINCT ON is currently supported only by the PostgreSQL " + ): + self.assert_compile(stm, "SELECT DISTINCT * FROM foo") + + class IsOrIsNotDistinctFromTest(fixtures.TablesTest): __backend__ = True __requires__ = ("supports_is_distinct_from",) |
