Visitar URL original
gh-99824: Document that sqlite3.connect implicitly open a transaction if autocommit=False by geryogam · Pull Request #99825 · python/cpython · GitHub
Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply CAM’s suggested change
  • Loading branch information
geryogam authored Nov 30, 2022
commit 0d15229dfaebcc31b8aad17ef3a75ec19dde1e03
10 changes: 3 additions & 7 deletions Doc/library/sqlite3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,6 @@ Module functions
By default (``0``), type detection is disabled.

:param isolation_level:
Control legacy transaction handling behaviour.
See :attr:`Connection.isolation_level` and
:ref:`sqlite3-transaction-control-isolation-level` for more information.
Can be ``"DEFERRED"`` (default), ``"EXCLUSIVE"`` or ``"IMMEDIATE"``;
Expand Down Expand Up @@ -326,11 +325,8 @@ Module functions
enabling various :ref:`sqlite3-uri-tricks`.

:param autocommit:
Control :pep:`249` transaction handling behaviour.
See :attr:`Connection.autocommit` and
:ref:`sqlite3-transaction-control-autocommit` for more information.
If ``False``, a new transaction is implicitly opened
when the :class:`Connection` is created.
*autocommit* currently defaults to
:data:`~sqlite3.LEGACY_TRANSACTION_CONTROL`.
The default will change to ``False`` in a future Python release.
Expand Down Expand Up @@ -2472,9 +2468,9 @@ which implies :pep:`249`-compliant transaction control.
This means:

* :mod:`!sqlite3` ensures that a transaction is always open,
so :meth:`Connection.commit` and :meth:`Connection.rollback`
will implicitly open a new transaction immediately after closing
the pending one.
so :func:`connect`, :meth:`Connection.commit`, and :meth:`Connection.rollback`
will implicitly open a new transaction
(immediately after closing the pending one, for the latter two).
:mod:`!sqlite3` uses ``BEGIN DEFERRED`` statements when opening transactions.
* Transactions should be committed explicitly using :meth:`!commit`.
* Transactions should be rolled back explicitly using :meth:`!rollback`.
Expand Down