@@ -1335,30 +1335,51 @@ Cursor objects
1335
1335
1336
1336
.. method :: execute(sql, parameters=(), /)
1337
1337
1338
- Execute SQL statement *sql *.
1339
- Bind values to the statement using :ref: `placeholders
1340
- <sqlite3-placeholders>` that map to the :term: `sequence ` or :class: `dict `
1341
- *parameters *.
1338
+ Execute SQL a single SQL statement,
1339
+ optionally binding Python values using
1340
+ :ref: `placeholders <sqlite3-placeholders >`.
1342
1341
1343
- :meth: `execute ` will only execute a single SQL statement. If you try to execute
1344
- more than one statement with it, it will raise a :exc: `ProgrammingError `. Use
1345
- :meth: `executescript ` if you want to execute multiple SQL statements with one
1346
- call.
1342
+ :param str sql:
1343
+ A single SQL statement.
1344
+
1345
+ :param parameters:
1346
+ Python values to bind to placeholders in *sql *.
1347
+ A :class: `!dict ` if named placeholders are used.
1348
+ A :term: `!sequence ` if unnamed placeholders are used.
1349
+ See :ref: `sqlite3-placeholders `.
1350
+ :type parameters: :class: `dict ` | :term: `sequence `
1351
+
1352
+ :raises ProgrammingError:
1353
+ If *sql * contains more than one SQL statement.
1347
1354
1348
1355
If :attr: `~Connection.isolation_level ` is not ``None ``,
1349
1356
*sql * is an ``INSERT ``, ``UPDATE ``, ``DELETE ``, or ``REPLACE `` statement,
1350
1357
and there is no open transaction,
1351
1358
a transaction is implicitly opened before executing *sql *.
1352
1359
1360
+ Use :meth: `executescript ` to execute multiple SQL statements.
1353
1361
1354
1362
.. method :: executemany(sql, parameters, /)
1355
1363
1356
- Execute :ref: ` parameterized < sqlite3-placeholders >` SQL statement * sql *
1357
- against all parameter sequences or mappings found in the sequence
1358
- * parameters *. It is also possible to use an
1359
- :term: ` iterator ` yielding parameters instead of a sequence.
1364
+ For every item in * parameters *,
1365
+ repeatedly execute the :ref: ` parameterized < sqlite3-placeholders >`
1366
+ SQL statement * sql *.
1367
+
1360
1368
Uses the same implicit transaction handling as :meth: `~Cursor.execute `.
1361
1369
1370
+ :param str sql:
1371
+ A single SQL :abbr: `DML ( Data Manipulation Language ) ` statement.
1372
+
1373
+ :param parameters:
1374
+ An :term: `!iterable ` of parameters to bind with
1375
+ the placeholders in *sql *.
1376
+ See :ref: `sqlite3-placeholders `.
1377
+ :type parameters: :term: `iterable `
1378
+
1379
+ :raises ProgrammingError:
1380
+ If *sql * contains more than one SQL statement,
1381
+ or is not a DML statment.
1382
+
1362
1383
Example:
1363
1384
1364
1385
.. testcode :: sqlite3.cursor
0 commit comments