Commit 133a3a5
fix: add nested transaction support
run_transaction utilizes the special 'cockroach_restart' protocol, as
per: https://www.cockroachlabs.com/blog/nested-transactions-in-cockroachdb-20-1/
In order to support nested transactions, the cockroach_restart protocol
for nested transactions can be related on versions after v20.1.
The motivation for this change was to allow multiple nested transactions
to occur over the same engine connection and high level
transaction (BEGIN/COMMIT). This allows one nested transaction to
perform an INSERT or UPDATE, while subsequent transactions could
retrieve that result (before the final COMMIT). This primarily works
around conditions in sqlalchemy, where one would like to perform an
orm.flush(), but cannot, when utilizing the cockroach run_transaction
model.
By default the run_transaction defaults to using the cockroach_restart
protocol, so no observed behavior is seen to current users.
Signed-off-by: Mike Marchetti <[email protected]>1 parent eb32469 commit 133a3a5
File tree
6 files changed
+812
-42
lines changed- sqlalchemy_cockroachdb
- test
6 files changed
+812
-42
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
0 commit comments