From d57c1c2ddd654a1077ab04ba7277828d9030c23d Mon Sep 17 00:00:00 2001 From: Idan Kamara Date: Thu, 6 Dec 2012 00:11:52 +0200 Subject: compiler: add support for multirow inserts Some databases support this syntax for inserts: INSERT INTO table (id, name) VALUES ('v1', 'v2'), ('v3', 'v4'); which greatly increases INSERT speed. It is now possible to pass a list of lists/tuples/dictionaries as the values param to the Insert construct. We convert it to a flat dictionary so we can continue using bind params. The above query will be converted to: INSERT INTO table (id, name) VALUES (:id, :name), (:id0, :name0); Currently only supported on postgresql, mysql and sqlite. --- lib/sqlalchemy/dialects/postgresql/base.py | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/sqlalchemy/dialects/postgresql/base.py') diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py index ed24bc1fe..22667b317 100644 --- a/lib/sqlalchemy/dialects/postgresql/base.py +++ b/lib/sqlalchemy/dialects/postgresql/base.py @@ -1182,6 +1182,7 @@ class PGDialect(default.DefaultDialect): supports_default_values = True supports_empty_insert = False + supports_multirow_insert = True default_paramstyle = 'pyformat' ischema_names = ischema_names colspecs = colspecs -- cgit v1.2.1