Skip to content
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

sqlite3 docs: clarify transaction control for SELECT #96810

Closed
KennyChenBasis opened this issue Sep 13, 2022 · 3 comments · Fixed by #96832
Closed

sqlite3 docs: clarify transaction control for SELECT #96810

KennyChenBasis opened this issue Sep 13, 2022 · 3 comments · Fixed by #96832
Assignees
Labels
docs Documentation in the Doc dir topic-sqlite3

Comments

@KennyChenBasis
Copy link

Documentation

In https://docs.python.org/3/library/sqlite3.html#transaction-control, it says that transactions are implicitly opened before INSERT, UPDATE, DELETE, or REPLACE statements, but it leaves open what happens for SELECT statements. Especially in the light of #54133, it should be more clear that SELECT statements don't start a transaction, either by saying "only" INSERT, etc. statements implicitly open transactions, or adding another sentence.

CC: @erlend-aasland @CAM-Gerlach

@KennyChenBasis KennyChenBasis added the docs Documentation in the Doc dir label Sep 13, 2022
@CAM-Gerlach
Copy link
Member

At least in my (beginner-level) reading of the docs, it seems implicit to me that a transaction is opened before these, and only these statements, i.e. in formal logic "If and only if a statement is a INSERT, UPDATE, DELETE or REPLACE statement, an SQL transaction is implicitly opened before that statement." But if there is concern that users might be uncertain if one is opened before SELECT, or we want to call attention to that fact (being the other member of the CRUD quartet), the the wording could be revised to add a parenthetical calling this out:

and executemany() executes INSERT, UPDATE, DELETE, or REPLACE (but not SELECT) statements.

@erlend-aasland ?

@erlend-aasland
Copy link
Contributor

Sure, I see no reason not to be explicit. It'll also help reduce the number of issues like this.

@erlend-aasland erlend-aasland moved this to In Progress in sqlite3 issues Sep 14, 2022
erlend-aasland added a commit to erlend-aasland/cpython that referenced this issue Sep 14, 2022
Repository owner moved this from In Progress to Done in sqlite3 issues Sep 15, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Sep 15, 2022
… transactions (pythonGH-96832)

(cherry picked from commit 16c33a9)

Co-authored-by: Erlend E. Aasland <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Sep 15, 2022
… transactions (pythonGH-96832)

(cherry picked from commit 16c33a9)

Co-authored-by: Erlend E. Aasland <[email protected]>
miss-islington added a commit that referenced this issue Sep 15, 2022
…actions (GH-96832)

(cherry picked from commit 16c33a9)

Co-authored-by: Erlend E. Aasland <[email protected]>
miss-islington added a commit that referenced this issue Sep 15, 2022
…actions (GH-96832)

(cherry picked from commit 16c33a9)

Co-authored-by: Erlend E. Aasland <[email protected]>
pablogsal pushed a commit that referenced this issue Oct 22, 2022
…actions (GH-96832)

(cherry picked from commit 16c33a9)

Co-authored-by: Erlend E. Aasland <[email protected]>
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 topic-sqlite3
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants