@@ -1044,30 +1044,53 @@ Cursor objects
1044
1044
1045
1045
.. method :: execute(sql, parameters=(), /)
1046
1046
1047
- Execute SQL statement *sql *.
1048
- Bind values to the statement using :ref: `placeholders
1049
- <sqlite3-placeholders>` that map to the :term: `sequence ` or :class: `dict `
1050
- *parameters *.
1047
+ Execute SQL a single SQL statement,
1048
+ optionally binding Python values using
1049
+ :ref: `placeholders <sqlite3-placeholders >`.
1051
1050
1052
- :meth: `execute ` will only execute a single SQL statement. If you try to execute
1053
- more than one statement with it, it will raise a :exc: `Warning `. Use
1054
- :meth: `executescript ` if you want to execute multiple SQL statements with one
1055
- call.
1051
+ :param str sql:
1052
+ A single SQL statement.
1053
+
1054
+ :param parameters:
1055
+ Python values to bind to placeholders in *sql *.
1056
+ A :class: `!dict ` if named placeholders are used.
1057
+ A :term: `!sequence ` if unnamed placeholders are used.
1058
+ See :ref: `sqlite3-placeholders `.
1059
+ :type parameters: :class: `dict ` | :term: `sequence `
1060
+
1061
+ :raises Warning:
1062
+ If *sql * contains more than one SQL statement.
1056
1063
1057
1064
If :attr: `~Connection.isolation_level ` is not ``None ``,
1058
1065
*sql * is an ``INSERT ``, ``UPDATE ``, ``DELETE ``, or ``REPLACE `` statement,
1059
1066
and there is no open transaction,
1060
1067
a transaction is implicitly opened before executing *sql *.
1061
1068
1069
+ Use :meth: `executescript ` to execute multiple SQL statements.
1062
1070
1063
1071
.. method :: executemany(sql, parameters, /)
1064
1072
1065
- Execute :ref: ` parameterized < sqlite3-placeholders >` SQL statement * sql *
1066
- against all parameter sequences or mappings found in the sequence
1067
- * parameters *. It is also possible to use an
1068
- :term: ` iterator ` yielding parameters instead of a sequence.
1073
+ For every item in * parameters *,
1074
+ repeatedly execute the :ref: ` parameterized < sqlite3-placeholders >`
1075
+ SQL statement * sql *.
1076
+
1069
1077
Uses the same implicit transaction handling as :meth: `~Cursor.execute `.
1070
1078
1079
+ :param str sql:
1080
+ A single SQL :abbr: `DML ( Data Manipulation Language ) ` statement.
1081
+
1082
+ :param parameters:
1083
+ An :term: `!iterable ` of parameters to bind with
1084
+ the placeholders in *sql *.
1085
+ See :ref: `sqlite3-placeholders `.
1086
+ :type parameters: :term: `iterable `
1087
+
1088
+ :raises ProgrammingError:
1089
+ If *sql * is not a DML statment.
1090
+
1091
+ :raises Warning:
1092
+ If *sql * contains more than one SQL statement.
1093
+
1071
1094
Example:
1072
1095
1073
1096
.. testcode :: sqlite3.cursor
0 commit comments