summaryrefslogtreecommitdiff
path: root/test/sql/test_insert.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2016-02-11 12:12:19 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2016-02-11 12:27:28 -0500
commite5f1a3fb7dc1888ed187fdeae8171e4ff322dab6 (patch)
tree320ef9285c4a4477ab90d838c216cba979bc4fc9 /test/sql/test_insert.py
parent287aaa9d416b4f72179da320af0624b9ebc43846 (diff)
downloadsqlalchemy-e5f1a3fb7dc1888ed187fdeae8171e4ff322dab6.tar.gz
- CTE functionality has been expanded to support all DML, allowing
INSERT, UPDATE, and DELETE statements to both specify their own WITH clause, as well as for these statements themselves to be CTE expressions when they include a RETURNING clause. fixes #2551
Diffstat (limited to 'test/sql/test_insert.py')
-rw-r--r--test/sql/test_insert.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/test/sql/test_insert.py b/test/sql/test_insert.py
index ea4de032c..513757d5b 100644
--- a/test/sql/test_insert.py
+++ b/test/sql/test_insert.py
@@ -188,9 +188,10 @@ class InsertTest(_InsertTestBase, fixtures.TablesTest, AssertsCompiledSQL):
from_select(("otherid", "othername"), sel)
self.assert_compile(
ins,
- "INSERT INTO myothertable (otherid, othername) WITH anon_1 AS "
+ "WITH anon_1 AS "
"(SELECT mytable.name AS name FROM mytable "
"WHERE mytable.name = :name_1) "
+ "INSERT INTO myothertable (otherid, othername) "
"SELECT mytable.myid, mytable.name FROM mytable, anon_1 "
"WHERE mytable.name = anon_1.name",
checkparams={"name_1": "bar"}
@@ -205,9 +206,9 @@ class InsertTest(_InsertTestBase, fixtures.TablesTest, AssertsCompiledSQL):
self.assert_compile(
ins,
- "INSERT INTO mytable (myid, name, description) "
"WITH c AS (SELECT mytable.myid AS myid, mytable.name AS name, "
"mytable.description AS description FROM mytable) "
+ "INSERT INTO mytable (myid, name, description) "
"SELECT c.myid, c.name, c.description FROM c"
)