diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-09-30 17:18:14 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-09-30 17:18:14 -0400 |
| commit | 62b7a8133a54a07934153b767a7f755a28beec24 (patch) | |
| tree | 92ca2f1747d686d2d1e73f98b4c771153e94a47a /test/sql/test_compiler.py | |
| parent | d8be99f7ed97ce8f33a42b76ec57d3e9d215f2ec (diff) | |
| download | sqlalchemy-62b7a8133a54a07934153b767a7f755a28beec24.tar.gz | |
- [bug] Fixed bug in over() construct whereby
passing an empty list for either partition_by
or order_by, as opposed to None, would fail
to generate correctly.
Courtesy Gunnlaugur Por Briem.
[ticket:2574]
Diffstat (limited to 'test/sql/test_compiler.py')
| -rw-r--r-- | test/sql/test_compiler.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/sql/test_compiler.py b/test/sql/test_compiler.py index 3c6e687ca..b09ae1ab0 100644 --- a/test/sql/test_compiler.py +++ b/test/sql/test_compiler.py @@ -2258,6 +2258,10 @@ class SelectTest(fixtures.TestBase, AssertsCompiledSQL): def test_over(self): self.assert_compile( + func.row_number().over(), + "row_number() OVER ()" + ) + self.assert_compile( func.row_number().over( order_by=[table1.c.name, table1.c.description] ), @@ -2297,6 +2301,30 @@ class SelectTest(fixtures.TestBase, AssertsCompiledSQL): ) self.assert_compile( + func.row_number().over( + partition_by=[], + order_by=[table1.c.name, table1.c.description] + ), + "row_number() OVER (ORDER BY mytable.name, mytable.description)" + ) + + self.assert_compile( + func.row_number().over( + partition_by=[table1.c.name, table1.c.description], + order_by=[] + ), + "row_number() OVER (PARTITION BY mytable.name, " + "mytable.description)" + ) + + self.assert_compile( + func.row_number().over( + partition_by=[], + order_by=[] + ), + "row_number() OVER ()" + ) + self.assert_compile( select([func.row_number().over( order_by=table1.c.description ).label('foo')]), |
