Skip to content

Clarify sqlite3 documentation of PEP 249 compliance for commit modes #99828

Closed as not planned
@geryogam

Description

@geryogam

Documentation

The sqlite3 documentation for the new Connection.autocommit attribute introduced in PR #93823 states:

   .. attribute:: autocommit

      This attribute controls :pep:`249`-compliant transaction behaviour.
      :attr:`!autocommit` has three allowed values:

      * ``False``: Select :pep:`249`-compliant transaction behaviour,
        implying that :mod:`!sqlite3` ensures a transaction is always open.

        This is the recommended value of :attr:`!autocommit`.

      * ``True``: Use SQLite's `autocommit mode`_.
        :meth:`commit` and :meth:`rollback` have no effect in this mode.

      * :data:`LEGACY_TRANSACTION_CONTROL`:
        Pre-Python 3.12 (non-:pep:`249`-compliant) transaction control.
        See :attr:`isolation_level` for more details.

The sentence ‘This attribute controls :pep:249-compliant transaction behaviour.’ is misleading as only the new manual commit mode (autocommit=False) is PEP-249-compliant, since PEP 249 specifies only the manual commit mode.

Likewise, the sentence ‘Pre-Python 3.12 (non-:pep:249-compliant) transaction control.’ is misleading as only the legacy manual commit mode (isolation_level='DEFERRED', isolation_level='EXCLUSIVE', or isolation_level='IMMEDIATE') is non-PEP-249-compliant, since PEP 249 specifies only the manual commit mode.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dirpendingThe issue will be closed if no feedback is providedtopic-sqlite3

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions