@@ -274,7 +274,7 @@ Connection Objects
274
274
275
275
.. attribute :: isolation_level
276
276
277
- Get or set the current isolation level. :const: `None ` for autocommit mode or
277
+ Get or set the current default isolation level. :const: `None ` for autocommit mode or
278
278
one of "DEFERRED", "IMMEDIATE" or "EXCLUSIVE". See section
279
279
:ref: `sqlite3-controlling-transactions ` for a more detailed explanation.
280
280
@@ -946,22 +946,30 @@ timestamp converter.
946
946
Controlling Transactions
947
947
------------------------
948
948
949
- By default, the :mod: `sqlite3 ` module opens transactions implicitly before a
950
- Data Modification Language (DML) statement (i.e.
951
- ``INSERT ``/``UPDATE ``/``DELETE ``/``REPLACE ``).
952
-
953
- You can control which kind of ``BEGIN `` statements sqlite3 implicitly executes
954
- (or none at all) via the *isolation_level * parameter to the :func: `connect `
955
- call, or via the :attr: `isolation_level ` property of connections.
949
+ The underlying ``sqlite3 `` library operates in ``autocommit `` mode by default,
950
+ but the Python :mod: `sqlite3 ` module by default does not.
956
951
957
- If you want **autocommit mode **, then set :attr: `isolation_level ` to ``None ``.
952
+ ``autocommit `` mode means that statements that modify the database take effect
953
+ immediately. A ``BEGIN `` or ``SAVEPOINT `` statement disables ``autocommit ``
954
+ mode, and a ``COMMIT ``, a ``ROLLBACK ``, or a ``RELEASE `` that ends the
955
+ outermost transaction, turns ``autocommit `` mode back on.
958
956
959
- Otherwise leave it at its default, which will result in a plain " BEGIN"
960
- statement, or set it to one of SQLite's supported isolation levels: "DEFERRED",
961
- "IMMEDIATE" or "EXCLUSIVE" .
957
+ The Python :mod: ` sqlite3 ` module by default issues a `` BEGIN `` statement
958
+ implicitly before a Data Modification Language (DML) statement (i.e.
959
+ `` INSERT ``/`` UPDATE ``/`` DELETE ``/`` REPLACE ``) .
962
960
963
- The current transaction state is exposed through the
964
- :attr: `Connection.in_transaction ` attribute of the connection object.
961
+ You can control which kind of ``BEGIN `` statements :mod: `sqlite3 ` implicitly
962
+ executes via the *isolation_level * parameter to the :func: `connect `
963
+ call, or via the :attr: `isolation_level ` property of connections.
964
+ If you specify no *isolation_level *, a plain ``BEGIN `` is used, which is
965
+ equivalent to specifying ``DEFERRED ``. Other possible values are ``IMMEDIATE ``
966
+ and ``EXCLUSIVE ``.
967
+
968
+ You can disable the :mod: `sqlite3 ` module's implicit transaction management by
969
+ setting :attr: `isolation_level ` to ``None ``. This will leave the underlying
970
+ ``sqlite3 `` library operating in ``autocommit `` mode. You can then completely
971
+ control the transaction state by explicitly issuing ``BEGIN ``, ``ROLLBACK ``,
972
+ ``SAVEPOINT ``, and ``RELEASE `` statements in your code.
965
973
966
974
.. versionchanged :: 3.6
967
975
:mod: `sqlite3 ` used to implicitly commit an open transaction before DDL
0 commit comments