diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-09-08 16:31:11 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-09-08 16:31:11 -0400 |
| commit | 7904ebc62e0a75d1ea31e1a4ae67654c7681a737 (patch) | |
| tree | a0e162ea74d3bb25390643b7db84bb288ca4e841 /test/sql/test_compiler.py | |
| parent | e4996d4f5432657639798c1b286ee811a36e2a10 (diff) | |
| download | sqlalchemy-7904ebc62e0a75d1ea31e1a4ae67654c7681a737.tar.gz | |
- rework the previous "order by" system in terms of the new one,
unify everything.
- create a new layer of separation between the "from order bys" and "column order bys",
so that an OVER doesn't ORDER BY a label in the same columns clause
- identify another issue with polymorphic for ref #3148, match on label
keys rather than the objects
Diffstat (limited to 'test/sql/test_compiler.py')
| -rw-r--r-- | test/sql/test_compiler.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/sql/test_compiler.py b/test/sql/test_compiler.py index 4f8ced72c..d47b58f1f 100644 --- a/test/sql/test_compiler.py +++ b/test/sql/test_compiler.py @@ -2169,6 +2169,27 @@ class SelectTest(fixtures.TestBase, AssertsCompiledSQL): "SELECT x + foo() OVER () AS anon_1" ) + # test a reference to a label that in the referecned selectable; + # this resolves + expr = (table1.c.myid + 5).label('sum') + stmt = select([expr]).alias() + self.assert_compile( + select([stmt.c.sum, func.row_number().over(order_by=stmt.c.sum)]), + "SELECT anon_1.sum, row_number() OVER (ORDER BY anon_1.sum) " + "AS anon_2 FROM (SELECT mytable.myid + :myid_1 AS sum " + "FROM mytable) AS anon_1" + ) + + # test a reference to a label that's at the same level as the OVER + # in the columns clause; doesn't resolve + expr = (table1.c.myid + 5).label('sum') + self.assert_compile( + select([expr, func.row_number().over(order_by=expr)]), + "SELECT mytable.myid + :myid_1 AS sum, " + "row_number() OVER " + "(ORDER BY mytable.myid + :myid_1) AS anon_1 FROM mytable" + ) + def test_date_between(self): import datetime table = Table('dt', metadata, |
