summaryrefslogtreecommitdiff
path: root/test/sql
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2007-04-18 22:54:40 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2007-04-18 22:54:40 +0000
commit4fffc21c87cbdfc538fe2924f82bf1591823856d (patch)
treef200a79e608f9e901baf515ce3d0e1b3b21b8bf6 /test/sql
parent7efd23b23cbbd1d714cc31e44e776b7e1e9af319 (diff)
downloadsqlalchemy-4fffc21c87cbdfc538fe2924f82bf1591823856d.tar.gz
- the "where" criterion of an update() and delete() now correlates
embedded select() statements against the table being updated or deleted. this works the same as nested select() statement correlation, and can be disabled via the correlate=False flag on the embedded select().
Diffstat (limited to 'test/sql')
-rw-r--r--test/sql/select.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/test/sql/select.py b/test/sql/select.py
index 91b293cbe..1d0a63e2f 100644
--- a/test/sql/select.py
+++ b/test/sql/select.py
@@ -828,10 +828,15 @@ class CRUDTest(SQLTest):
u = update(table1, table1.c.name == 'jack', values = {table1.c.name : s})
self.runtest(u, "UPDATE mytable SET name=(SELECT myothertable.otherid, myothertable.othername FROM myothertable WHERE myothertable.otherid = mytable.myid) WHERE mytable.name = :mytable_name")
- # test a correlated WHERE clause
+ # test a non-correlated WHERE clause
s = select([table2.c.othername], table2.c.otherid == 7)
u = update(table1, table1.c.name==s)
self.runtest(u, "UPDATE mytable SET myid=:myid, name=:name, description=:description WHERE mytable.name = (SELECT myothertable.othername FROM myothertable WHERE myothertable.otherid = :myothertable_otherid)")
+
+ # test one that is actually correlated...
+ s = select([table2.c.othername], table2.c.otherid == table1.c.myid)
+ u = table1.update(table1.c.name==s)
+ self.runtest(u, "UPDATE mytable SET myid=:myid, name=:name, description=:description WHERE mytable.name = (SELECT myothertable.othername FROM myothertable WHERE myothertable.otherid = mytable.myid)")
def testdelete(self):
self.runtest(delete(table1, table1.c.myid == 7), "DELETE FROM mytable WHERE mytable.myid = :mytable_myid")