Savepoint
PronunciationSAYV-poynt
Definition
A savepoint is a marker inside a transaction that you can roll back to, undoing only the work after it while keeping everything before it.
Where you hear it
In SQL (SAVEPOINT), Django nested atomic() blocks and tests that wrap each case in a transaction.
Examples
Create a savepoint, try the risky insert, and roll back to it if it fails.
A nested
atomic()in Django becomes a savepoint.We set a savepoint before the bulk import, so a bad batch rolls back on its own.
Common mistake
Catching a database error inside a transaction without a savepoint. The whole transaction is then unusable.
Don't confuse with
A full rollback, which cancels the whole transaction.
Say it at work
- In a meeting or chat
Wrap the optional step in a savepoint.
- In an email or ticket
Roll back to the savepoint, not the whole transaction.