summaryrefslogtreecommitdiff
path: root/test/sql/test_compiler.py
diff options
context:
space:
mode:
authorIlja Everilä <saarni@gmail.com>2014-09-11 15:39:56 +0300
committerIlja Everilä <saarni@gmail.com>2014-09-11 15:39:56 +0300
commit52a095ba6675f5f5807a1dc655b4ae32b9999f27 (patch)
tree88a3592ea51dbca2e438b720ca303050d9c14d54 /test/sql/test_compiler.py
parentab1c25266dd49f087b5fff316b6ba6fb610b1d35 (diff)
downloadsqlalchemy-52a095ba6675f5f5807a1dc655b4ae32b9999f27.tar.gz
allow windowing filtered functions
Diffstat (limited to 'test/sql/test_compiler.py')
-rw-r--r--test/sql/test_compiler.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/sql/test_compiler.py b/test/sql/test_compiler.py
index 7bba29563..fc33db184 100644
--- a/test/sql/test_compiler.py
+++ b/test/sql/test_compiler.py
@@ -2254,6 +2254,33 @@ class SelectTest(fixtures.TestBase, AssertsCompiledSQL):
"AS anon_1 FROM mytable"
)
+ # test filtered windowing:
+ self.assert_compile(
+ select([
+ func.rank().filter(
+ table1.c.name > 'foo'
+ ).over(
+ order_by=table1.c.name
+ )
+ ]),
+ "SELECT rank() FILTER (WHERE mytable.name > :name_1) "
+ "OVER (ORDER BY mytable.name) AS anon_1 FROM mytable"
+ )
+
+ self.assert_compile(
+ select([
+ func.rank().filter(
+ table1.c.name > 'foo'
+ ).over(
+ order_by=table1.c.name,
+ partition_by=['description']
+ )
+ ]),
+ "SELECT rank() FILTER (WHERE mytable.name > :name_1) "
+ "OVER (PARTITION BY mytable.description ORDER BY mytable.name) "
+ "AS anon_1 FROM mytable"
+ )
+
def test_date_between(self):
import datetime
table = Table('dt', metadata,