@@ -1418,15 +1418,22 @@ Cursor objects
1418
1418
1419
1419
.. method :: execute(sql, parameters=(), /)
1420
1420
1421
- Execute SQL statement *sql *.
1422
- Bind values to the statement using :ref: `placeholders
1423
- <sqlite3-placeholders>` that map to the :term: `sequence ` or :class: `dict `
1424
- *parameters *.
1421
+ Execute SQL a single SQL statement,
1422
+ optionally binding Python values using
1423
+ :ref: `placeholders <sqlite3-placeholders >`.
1425
1424
1426
- :meth: `execute ` will only execute a single SQL statement. If you try to execute
1427
- more than one statement with it, it will raise a :exc: `ProgrammingError `. Use
1428
- :meth: `executescript ` if you want to execute multiple SQL statements with one
1429
- call.
1425
+ :param str sql:
1426
+ A single SQL statement.
1427
+
1428
+ :param parameters:
1429
+ Python values to bind to placeholders in *sql *.
1430
+ A :class: `!dict ` if named placeholders are used.
1431
+ A :term: `!sequence ` if unnamed placeholders are used.
1432
+ See :ref: `sqlite3-placeholders `.
1433
+ :type parameters: :class: `dict ` | :term: `sequence `
1434
+
1435
+ :raises ProgrammingError:
1436
+ If *sql * contains more than one SQL statement.
1430
1437
1431
1438
If :attr: `~Connection.autocommit ` is
1432
1439
:data: `LEGACY_TRANSACTION_CONTROL `,
@@ -1435,15 +1442,29 @@ Cursor objects
1435
1442
and there is no open transaction,
1436
1443
a transaction is implicitly opened before executing *sql *.
1437
1444
1445
+ Use :meth: `executescript ` to execute multiple SQL statements.
1438
1446
1439
1447
.. method :: executemany(sql, parameters, /)
1440
1448
1441
- Execute :ref: ` parameterized < sqlite3-placeholders >` SQL statement * sql *
1442
- against all parameter sequences or mappings found in the sequence
1443
- * parameters *. It is also possible to use an
1444
- :term: ` iterator ` yielding parameters instead of a sequence.
1449
+ For every item in * parameters *,
1450
+ repeatedly execute the :ref: ` parameterized < sqlite3-placeholders >`
1451
+ SQL statement * sql *.
1452
+
1445
1453
Uses the same implicit transaction handling as :meth: `~Cursor.execute `.
1446
1454
1455
+ :param str sql:
1456
+ A single SQL :abbr: `DML ( Data Manipulation Language ) ` statement.
1457
+
1458
+ :param parameters:
1459
+ An :term: `!iterable ` of parameters to bind with
1460
+ the placeholders in *sql *.
1461
+ See :ref: `sqlite3-placeholders `.
1462
+ :type parameters: :term: `iterable `
1463
+
1464
+ :raises ProgrammingError:
1465
+ If *sql * contains more than one SQL statement,
1466
+ or is not a DML statment.
1467
+
1447
1468
Example:
1448
1469
1449
1470
.. testcode :: sqlite3.cursor
0 commit comments