diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-06-21 16:32:38 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-06-21 16:32:38 -0400 |
| commit | d5609d77841ab4e607e6b372a15396b38ddace9a (patch) | |
| tree | eb6faaeed9e58ed6d87b675eb0c27f363fc4de56 /test/sql/test_compiler.py | |
| parent | 2272f30af435c5283157724bbb16fb0a573159ce (diff) | |
| download | sqlalchemy-d5609d77841ab4e607e6b372a15396b38ddace9a.tar.gz | |
- [feature] Added "MATCH" clause to ForeignKey,
ForeignKeyConstraint, courtesy Ryan Kelly.
[ticket:2502]
- [feature] Added support for DELETE and UPDATE from
an alias of a table, which would assumedly
be related to itself elsewhere in the query,
courtesy Ryan Kelly. [ticket:2507]
- [feature] Added support for the Postgresql ONLY
keyword, which can appear corresponding to a
table in a SELECT, UPDATE, or DELETE statement.
The phrase is established using with_hint().
Courtesy Ryan Kelly [ticket:2506]
Diffstat (limited to 'test/sql/test_compiler.py')
| -rw-r--r-- | test/sql/test_compiler.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/sql/test_compiler.py b/test/sql/test_compiler.py index 61dcf61ab..4bf0eb70e 100644 --- a/test/sql/test_compiler.py +++ b/test/sql/test_compiler.py @@ -2906,6 +2906,18 @@ class CRUDTest(fixtures.TestBase, AssertsCompiledSQL): "WHERE mytable.myid = hoho(:hoho_1) AND mytable.name = :param_2 || " "mytable.name || :param_3") + def test_aliased_update(self): + talias1 = table1.alias('t1') + self.assert_compile( + update(talias1, talias1.c.myid == 7), + "UPDATE mytable AS t1 SET name=:name WHERE t1.myid = :myid_1", + params = {table1.c.name:'fred'}) + self.assert_compile( + update(talias1, table1.c.myid == 7), + "UPDATE mytable AS t1 SET name=:name FROM " + "mytable WHERE mytable.myid = :myid_1", + params = {table1.c.name:'fred'}) + def test_correlated_update(self): # test against a straight text subquery u = update(table1, values = { @@ -2988,6 +3000,12 @@ class CRUDTest(fixtures.TestBase, AssertsCompiledSQL): "DELETE FROM mytable WHERE mytable.myid = :myid_1 " "AND mytable.name = :name_1") + def test_aliased_delete(self): + talias1 = table1.alias('t1') + self.assert_compile( + delete(talias1).where(talias1.c.myid == 7), + "DELETE FROM mytable AS t1 WHERE t1.myid = :myid_1") + def test_correlated_delete(self): # test a non-correlated WHERE clause s = select([table2.c.othername], table2.c.otherid == 7) |
