mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-08-01 19:00:09 +03:00
add execute_batch examples, analog to executemany
This commit is contained in:
parent
cf22e65f19
commit
a84bbddc5c
|
@ -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::
|
||||
|
|
Loading…
Reference in New Issue
Block a user