Skip to content

fix: add transaction guard to vacuum() method (fixes #479) - #862

Closed
KooshaPari wants to merge 1 commit into
simonw:mainfrom
KooshaPari:fix-4-vacuum-guard
Closed

KooshaPari wants to merge 1 commit into
simonw:mainfrom
KooshaPari:fix-4-vacuum-guard

Conversation

@KooshaPari

@KooshaPari KooshaPari commented Sep 13, 2026

Copy link
Copy Markdown

Fixes #479

Changes

  • Added _ensure_no_open_transaction and ensure_autocommit_on guards to Database.vacuum(), matching the pattern used by enable_wal() and disable_wal()
  • Now raises a clear TransactionError with a descriptive message instead of a cryptic OperationalError: cannot VACUUM from within a transaction

Testing

  • Added test_vacuum_raises_transaction_error_inside_atomic to verify TransactionError is raised
  • Added test_vacuum_works_outside_atomic to verify normal operation still works
  • All 31 tests in test_atomic.py pass

📚 Documentation preview 📚: https://sqlite-utils--862.org.readthedocs.build/en/862/

Copilot AI lite review requested due to automatic review settings September 13, 2026 06:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@KooshaPari KooshaPari closed this by deleting the head repository Sep 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OperationalError: cannot VACUUM from within a transaction

2 participants