feat(dbapi): add retry_aborts_internally option to Connection by waiho-gumloop · Pull Request #1538 · googleapis/python-spanner

@waiho-gumloop

Add a `retry_aborts_internally` flag (default True) to the DBAPI
Connection class and the `connect()` function. When set to False,
aborted transactions raise `RetryAborted` directly from `commit()`
instead of entering the internal statement-replay retry loop.

This allows applications that implement their own transaction retry
logic (e.g. re-invoking a callable with a fresh session) to avoid
nested retry loops and contention amplification under concurrent
writes.

Equivalent to `RETRY_ABORTS_INTERNALLY` in the Spanner JDBC driver
and `ReadWriteStmtBasedTransaction` in the Go client.

gemini-code-assist[bot]