Opened 16 months ago

Closed 16 months ago

Last modified 16 months ago

#21836 closed Cleanup/optimization (fixed)

clarify behavior of autocommit mode in presence of transaction

Reported by: cjerdonek Owned by: aaugustin
Component: Documentation Version: 1.6
Severity: Normal Keywords: autocommit, transactions, database
Cc: chris.jerdonek@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

As someone relatively new to Django, in reading the Database transactions section of the Django docs, I thought a couple things could be clarified or improved.

Namely, it would be helpful to clarify that both (1) the default "autocommit" behavior of immediately committing doesn't occur if a transaction has already been started, and (2) Django's main TestCase class implicitly starts a transaction (thus "suspending" the default autocommit behavior). Not mentioning the latter in the main transaction docs contributed to my running into documentation issue #21540, so I think resolving this issue will help address issue #21540.

I've already written up a proposed patch with suggested wording for the above. I will post it to this issue shortly. Thanks.

Change History (9)

comment:1 Changed 16 months ago by cjerdonek

  • Cc chris.jerdonek@… added
  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to cjerdonek
  • Patch needs improvement unset
  • Status changed from new to assigned

comment:2 Changed 16 months ago by cjerdonek

  • Type changed from Uncategorized to Cleanup/optimization

comment:3 Changed 16 months ago by cjerdonek

  • Has patch set

I made pull request 2191 for this.

comment:4 Changed 16 months ago by aaugustin

  • Owner changed from cjerdonek to aaugustin

comment:5 Changed 16 months ago by timo

  • Triage Stage changed from Unreviewed to Ready for checkin

(leaving open for Aymeric to take a look)

comment:6 Changed 16 months ago by aaugustin

The suggestions are legitimate but I believe the patch was less precise than the original in several sentences. I'll commit a slightly edited version.

Last edited 16 months ago by aaugustin (previous) (diff)

comment:7 Changed 16 months ago by Aymeric Augustin <aymeric.augustin@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

In 798fd59fad241ca8e48ba2a4526935b92736d30d:

Fixed #21836 -- Improved transaction docs about autocommit mode

Clarified that queries in autocommit mode are committed immediately
only if a transaction has not already been started. Added to the
main transaction docs that Django's TestCase class implicitly wraps
its tests in transactions.

comment:8 Changed 16 months ago by Aymeric Augustin <aymeric.augustin@…>

In a21fc1c08667dc319601b8195d0a7d3a4b8f2af5:

[1.6.x] Fixed #21836 -- Improved transaction docs about autocommit mode

Clarified that queries in autocommit mode are committed immediately
only if a transaction has not already been started. Added to the
main transaction docs that Django's TestCase class implicitly wraps
its tests in transactions.

Backport of 798fd59f from master.

comment:9 Changed 16 months ago by Aymeric Augustin <aymeric.augustin@…>

In a0a6112afc08c7471b70ee5e35170dfee3b488f3:

[1.6.x] Fixed typo. Refs #21836.

Backport of 8e1fc03 from master

Note: See TracTickets for help on using tickets.
Back to Top