Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
geryogam opened this issue Nov 27, 2022 · 2 comments
Closed

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

geryogam opened this issue Nov 27, 2022 · 2 comments
Labels
docs Documentation in the Doc dir pending The issue will be closed if no feedback is provided topic-sqlite3

Comments

@geryogam
Copy link
Contributor

geryogam commented Nov 27, 2022

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

@erlend-aasland
Copy link
Contributor

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.

It is not misleading. PEP-249 says that autocommit is True implies leaving the "autocommitting" to SQLite. That is what we do, and there is nothing "non-PEP-249-compliant" about that.

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.

Ditto. IMO, this is perfectly fine.

AFAICS, there is no need to change those wordings; suggesting to close this issue.

Thanks for your interest in improving the docs!

@erlend-aasland erlend-aasland added the pending The issue will be closed if no feedback is provided label Nov 28, 2022
@geryogam
Copy link
Contributor Author

Fair enough. Thanks for the discussion.

@erlend-aasland erlend-aasland closed this as not planned Won't fix, can't repro, duplicate, stale Nov 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir pending The issue will be closed if no feedback is provided topic-sqlite3
Projects
None yet
Development

No branches or pull requests

2 participants