summaryrefslogtreecommitdiff
path: root/test/sql/test_compiler.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/sql/test_compiler.py')
-rw-r--r--test/sql/test_compiler.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/sql/test_compiler.py b/test/sql/test_compiler.py
index 50b425a01..3b0e421ae 100644
--- a/test/sql/test_compiler.py
+++ b/test/sql/test_compiler.py
@@ -2552,6 +2552,21 @@ class CRUDTest(fixtures.TestBase, AssertsCompiledSQL):
table.insert(inline=True),
"INSERT INTO sometable (foo) VALUES (foobar())", params={})
+ def test_multirow_insert(self):
+ data = [(1, 'a', 'b'), (2, 'a', 'b')]
+ result = "INSERT INTO mytable (myid, name, description) VALUES " \
+ "(%(myid)s, %(name)s, %(description)s), " \
+ "(%(myid0)s, %(name0)s, %(description0)s)"
+
+ stmt = insert(table1, data, dialect='postgresql')
+ self.assert_compile(stmt, result, dialect=postgresql.dialect())
+
+ stmt = table1.insert(values=data, dialect='postgresql')
+ self.assert_compile(stmt, result, dialect=postgresql.dialect())
+
+ stmt = table1.insert(dialect='postgresql').values(data)
+ self.assert_compile(stmt, result, dialect=postgresql.dialect())
+
def test_update(self):
self.assert_compile(
update(table1, table1.c.myid == 7),