CRDB provides client-side transaction retries, which are available using a special helper-method. This method accepts a callable, which is responsible for executing any transactional statements that may need to be retried.
# Callable that accepts a single argument (the database instance) and
# which is responsible for executing the transactional SQL.
return db.run_transaction(callback, max_attempts=10)
Note
For more information, see:
- CRDB extension documentation
- (postgres-specific, but applies to CRDB)