diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2018-08-19 22:19:59 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2018-08-19 22:22:24 -0400 |
| commit | 3e2f61c439dab76133a49b7a16b03bf4071d4c4c (patch) | |
| tree | 7d3ba13926308309286bd5ccf9618c4bd22cbd4b /test/sql/test_functions.py | |
| parent | c3869f23836bd35d5ed565a4b84b4ab70293c0f7 (diff) | |
| download | sqlalchemy-3e2f61c439dab76133a49b7a16b03bf4071d4c4c.tar.gz | |
Add missing range_ / rows parameters to additional over() methods
Added missing window function parameters
:paramref:`.WithinGroup.over.range_` and :paramref:`.WithinGroup.over.rows`
parameters to the :meth:`.WithinGroup.over` and
:meth:`.FunctionFilter.over` methods, to correspond to the range/rows
feature added to the "over" method of SQL functions as part of
:ticket:`3049` in version 1.1.
Fixes: #4322
Change-Id: I77dcdac65c699a4b52a3fc3ee09a100ffb4fc20e
Diffstat (limited to 'test/sql/test_functions.py')
| -rw-r--r-- | test/sql/test_functions.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/sql/test_functions.py b/test/sql/test_functions.py index 3032c3ce3..48d5fc37f 100644 --- a/test/sql/test_functions.py +++ b/test/sql/test_functions.py @@ -513,6 +513,38 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL): "AS anon_1 FROM mytable" ) + def test_funcfilter_windowing_range(self): + self.assert_compile( + select([ + func.rank().filter( + table1.c.name > 'foo' + ).over( + range_=(1, 5), + partition_by=['description'] + ) + ]), + "SELECT rank() FILTER (WHERE mytable.name > :name_1) " + "OVER (PARTITION BY mytable.description RANGE BETWEEN :param_1 " + "FOLLOWING AND :param_2 FOLLOWING) " + "AS anon_1 FROM mytable" + ) + + def test_funcfilter_windowing_rows(self): + self.assert_compile( + select([ + func.rank().filter( + table1.c.name > 'foo' + ).over( + rows=(1, 5), + partition_by=['description'] + ) + ]), + "SELECT rank() FILTER (WHERE mytable.name > :name_1) " + "OVER (PARTITION BY mytable.description ROWS BETWEEN :param_1 " + "FOLLOWING AND :param_2 FOLLOWING) " + "AS anon_1 FROM mytable" + ) + def test_funcfilter_within_group(self): stmt = select([ table1.c.myid, |
