insert from select column ordering
Issue #2895
resolved
diff --git a/test/sql/test_insert.py b/test/sql/test_insert.py
index e117153..22c6147 100644
--- a/test/sql/test_insert.py
+++ b/test/sql/test_insert.py
@@ -133,6 +133,20 @@ class InsertTest(_InsertTestBase, fixtures.TablesTest, AssertsCompiledSQL):
checkparams={"name_1": "foo"}
)
+
+ def test_insert_from_select_select_alt_ordering(self):
+ table1 = self.tables.mytable
+ sel = select([table1.c.myid, ](table1.c.name,)).where(table1.c.name == 'foo')
+ ins = self.tables.myothertable.insert().\
+ from_select(("othername", "otherid"), sel)
+ self.assert_compile(
+ ins,
+ "INSERT INTO myothertable (otherid, othername) "
+ "SELECT mytable.myid, mytable.name FROM mytable "
+ "WHERE mytable.name = :name_1",
+ checkparams={"name_1": "foo"}
+ )
+
def test_insert_mix_select_values_exception(self):
table1 = self.tables.mytable
sel = select([table1.c.name](table1.c.myid,)).where(table1.c.name == 'foo')
current output is:
INSERT INTO myothertable (otherid, othername) SELECT mytable.name, mytable.myid FROM mytable WHERE mytable.name = :name_1
Comments (2)
-
reporter -
reporter - removed milestone
Removing milestone: 0.8.xx (automated comment)
- Log in to comment
2042493228a92fede38f39cd144d6ea74abbcb21 0.8
5f76f29c15b7a23cfe29c5fbd22ad02452b6a2c0 0.9