From 3b48918bef71162c05da9c16962ef79cab2df31a Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Tue, 28 Mar 2017 10:37:04 +0100 Subject: [PATCH] Note that the fast executemany functions don't respect rowcount See issue #540 --- lib/extras.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/extras.py b/lib/extras.py index 9e16165a..69c7f320 100644 --- a/lib/extras.py +++ b/lib/extras.py @@ -1178,6 +1178,9 @@ def execute_batch(cur, sql, argslist, page_size=100): fewer multi-statement commands, each one containing at most *page_size* statements, resulting in a reduced number of server roundtrips. + After the execution of the functtion the `cursor.rowcount` property will + **not** contain a total result. + """ for page in _paginate(argslist, page_size=page_size): sqls = [cur.mogrify(sql, args) for args in page] @@ -1212,6 +1215,9 @@ def execute_values(cur, sql, argslist, template=None, page_size=100): .. __: https://www.postgresql.org/docs/current/static/queries-values.html + After the execution of the functtion the `cursor.rowcount` property will + **not** contain a total result. + While :sql:`INSERT` is an obvious candidate for this function it is possible to use it with other statements, for example::