diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-09-16 18:17:34 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-09-16 18:17:34 +0000 |
| commit | d47a469732f0695c612615819c3273afbb28ed76 (patch) | |
| tree | 49131efd5f83863b09e58a00d5bde4cd778aa30e /test/sql/select.py | |
| parent | e0cc32c93729e04f660a3ca431457dea8b8c32b1 (diff) | |
| download | sqlalchemy-d47a469732f0695c612615819c3273afbb28ed76.tar.gz | |
- 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]
Diffstat (limited to 'test/sql/select.py')
| -rw-r--r-- | test/sql/select.py | 17 |
1 files changed, 13 insertions, 4 deletions
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), |
