From d47a469732f0695c612615819c3273afbb28ed76 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Tue, 16 Sep 2008 18:17:34 +0000 Subject: - version bump - turned properties in sql/expressions.py to @property - column.in_(someselect) can now be used as a columns-clause expression without the subquery bleeding into the FROM clause [ticket:1074] --- test/sql/select.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'test/sql') diff --git a/test/sql/select.py b/test/sql/select.py index facfb5287..3b6964e7d 100644 --- a/test/sql/select.py +++ b/test/sql/select.py @@ -1166,13 +1166,13 @@ UNION SELECT mytable.myid FROM mytable" self.assert_compile(select([table1], table1.c.myid.in_( union( - select([table1], table1.c.myid == 5), - select([table1], table1.c.myid == 12), + select([table1.c.myid], table1.c.myid == 5), + select([table1.c.myid], table1.c.myid == 12), ) )), "SELECT mytable.myid, mytable.name, mytable.description FROM mytable \ WHERE mytable.myid IN (\ -SELECT mytable.myid, mytable.name, mytable.description FROM mytable WHERE mytable.myid = :myid_1 \ -UNION SELECT mytable.myid, mytable.name, mytable.description FROM mytable WHERE mytable.myid = :myid_2)") +SELECT mytable.myid FROM mytable WHERE mytable.myid = :myid_1 \ +UNION SELECT mytable.myid FROM mytable WHERE mytable.myid = :myid_2)") # test that putting a select in an IN clause does not blow away its ORDER BY clause self.assert_compile( @@ -1191,6 +1191,15 @@ UNION SELECT mytable.myid, mytable.name, mytable.description FROM mytable WHERE self.assert_compile(select([table1], table1.c.myid.in_([])), "SELECT mytable.myid, mytable.name, mytable.description FROM mytable WHERE (CASE WHEN (mytable.myid IS NULL) THEN NULL ELSE 0 END = 1)") + self.assert_compile( + select([table1.c.myid.in_(select([table2.c.otherid]))]), + "SELECT mytable.myid IN (SELECT myothertable.otherid FROM myothertable) AS anon_1 FROM mytable" + ) + self.assert_compile( + select([table1.c.myid.in_(select([table2.c.otherid]).as_scalar())]), + "SELECT mytable.myid IN (SELECT myothertable.otherid FROM myothertable) AS anon_1 FROM mytable" + ) + def test_cast(self): tbl = table('casttest', column('id', Integer), -- cgit v1.2.1