From 7f757fb44ad06fa8436facf157c4ed96ddfe0b53 Mon Sep 17 00:00:00 2001 From: Derek Knapp Date: Fri, 9 Feb 2024 22:09:12 -0800 Subject: [PATCH] docs --- docs/transaction.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/transaction.rst b/docs/transaction.rst index d5f6788d5..8fe31a8ef 100644 --- a/docs/transaction.rst +++ b/docs/transaction.rst @@ -94,7 +94,8 @@ Now, say you make another attempt to debit one of the accounts when they don't h condition=( (BankStatement.account_balance >= transfer_amount) & (BankStatement.is_active == True) - ) + ), + return_values=ALL_OLD ) transaction.update( BankStatement(user_id='user2'), @@ -107,6 +108,8 @@ Now, say you make another attempt to debit one of the accounts when they don't h assert e.cause_response_code == 'TransactionCanceledException' # the first 'update' was a reason for the cancellation assert e.cancellation_reasons[0].code == 'ConditionalCheckFailed' + # when return_values=ALL_OLD, the old values can be accessed from the item property + assert BankStatement.from_dynamodb_dict(e.cancellation_reasons[0].item) == user1_statement # the second 'update' wasn't a reason, but was cancelled too assert e.cancellation_reasons[1] is None