mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-25 18:33:44 +03:00
docs: fix reST syntax and whitespace in executemany examples
This commit is contained in:
parent
aabac5df31
commit
f401d0b738
|
@ -207,10 +207,12 @@ The ``cursor`` class
|
||||||
|
|
||||||
Parameters are bounded to the query using the same rules described in
|
Parameters are bounded to the query using the same rules described in
|
||||||
the `~cursor.execute()` method.
|
the `~cursor.execute()` method.
|
||||||
|
|
||||||
|
.. code:: python
|
||||||
|
|
||||||
>>> nums = ((1,), (5,), (10,))
|
>>> nums = ((1,), (5,), (10,))
|
||||||
>>> cur.executemany("INSERT INTO test (num) VALUES (%s)", nums)
|
>>> cur.executemany("INSERT INTO test (num) VALUES (%s)", nums)
|
||||||
|
|
||||||
>>> tuples = ((123, "foo"), (42, "bar"), (23, "baz"))
|
>>> tuples = ((123, "foo"), (42, "bar"), (23, "baz"))
|
||||||
>>> cur.executemany("INSERT INTO test (num, data) VALUES (%s, %s)", tuples)
|
>>> cur.executemany("INSERT INTO test (num, data) VALUES (%s, %s)", tuples)
|
||||||
|
|
||||||
|
|
|
@ -1029,11 +1029,13 @@ parameters. By reducing the number of server roundtrips the performance can be
|
||||||
|
|
||||||
.. autofunction:: execute_batch
|
.. autofunction:: execute_batch
|
||||||
|
|
||||||
>>> nums = ((1,), (5,), (10,))
|
.. code:: python
|
||||||
>>> execute_batch(cur, "INSERT INTO test (num) VALUES (%s)", nums)
|
|
||||||
|
>>> nums = ((1,), (5,), (10,))
|
||||||
>>> tuples = ((123, "foo"), (42, "bar"), (23, "baz"))
|
>>> execute_batch(cur, "INSERT INTO test (num) VALUES (%s)", nums)
|
||||||
>>> execute_batch(cur, "INSERT INTO test (num, data) VALUES (%s, %s)", tuples)
|
|
||||||
|
>>> tuples = ((123, "foo"), (42, "bar"), (23, "baz"))
|
||||||
|
>>> execute_batch(cur, "INSERT INTO test (num, data) VALUES (%s, %s)", tuples)
|
||||||
|
|
||||||
.. versionadded:: 2.7
|
.. versionadded:: 2.7
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user