From a84bbddc5c2764f49392d2b55db2e9df50618958 Mon Sep 17 00:00:00 2001 From: kannes Date: Wed, 16 Jan 2019 16:05:00 +0100 Subject: [PATCH] add execute_batch examples, analog to executemany --- doc/src/extras.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/src/extras.rst b/doc/src/extras.rst index d7600bbf..ded77fe4 100644 --- a/doc/src/extras.rst +++ b/doc/src/extras.rst @@ -986,6 +986,12 @@ parameters. By reducing the number of server roundtrips the performance can be .. autofunction:: execute_batch + >>> nums = [[1],[5],[10]] + >>> execute_batch(cur, "INSERT INTO test (num) VALUES (%s)", nums) + + >>> tuples = ((123,"foo"), (42,"bar"), (23,"baz")) + >>> execute_batch(cur, "INSERT INTO test (num, data) VALUES (%s, %s)", tuples) + .. versionadded:: 2.7 .. note::