diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-06-24 18:46:02 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-06-24 18:46:02 +0000 |
| commit | f9dc30f239d1aa13771f0e152af691a8ae56514b (patch) | |
| tree | bd8e4a1a2239b37d91dbbd70a87301794bf6e5c7 /test/sql | |
| parent | 7cfd3973ce7596091ec8abd1b314811716c8e93d (diff) | |
| download | sqlalchemy-f9dc30f239d1aa13771f0e152af691a8ae56514b.tar.gz | |
added test for correlation of scalar subqueries to a JOIN object
Diffstat (limited to 'test/sql')
| -rw-r--r-- | test/sql/select.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/sql/select.py b/test/sql/select.py index 37c597a8c..01fbd5cc8 100644 --- a/test/sql/select.py +++ b/test/sql/select.py @@ -175,6 +175,7 @@ sq.myothertable_othername AS sq_myothertable_othername FROM (" + sqstring + ") A s, "SELECT mytable.myid, mytable.name, mytable.description FROM mytable WHERE EXISTS (SELECT 1 FROM myothertable WHERE myothertable.otherid = mytable.myid)" ) + def testorderbysubquery(self): self.runtest( @@ -223,6 +224,12 @@ sq.myothertable_othername AS sq_myothertable_othername FROM (" + sqstring + ") A ) self.runtest(q, "SELECT places.id, places.nm, main_zip.zipcode, latlondist((SELECT zips.latitude FROM zips WHERE zips.zipcode = main_zip.zipcode), (SELECT zips.longitude FROM zips WHERE zips.zipcode = main_zip.zipcode)) AS dist FROM places, zips AS main_zip ORDER BY dist, places.nm") + a1 = table2.alias('t2alias') + s1 = select([a1.c.otherid], table1.c.myid==a1.c.otherid, scalar=True) + j1 = table1.join(table2, table1.c.myid==table2.c.otherid) + s2 = select([table1, s1], from_obj=[j1]) + self.runtest(s2, "SELECT mytable.myid, mytable.name, mytable.description, (SELECT t2alias.otherid FROM myothertable AS t2alias WHERE mytable.myid = t2alias.otherid) FROM mytable JOIN myothertable ON mytable.myid = myothertable.otherid") + def testlabelcomparison(self): x = func.lala(table1.c.myid).label('foo') self.runtest(select([x], x==5), "SELECT lala(mytable.myid) AS foo FROM mytable WHERE lala(mytable.myid) = :literal") |
