Add support for condition failure return values#1
Open
Tomas Neme (Lacrymology) wants to merge 4 commits into
Open
Add support for condition failure return values#1Tomas Neme (Lacrymology) wants to merge 4 commits into
Tomas Neme (Lacrymology) wants to merge 4 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contains
Issue
DynamoDB supports
ReturnValuesOnConditionCheckFailurefor conditional writes so callers can request the old item image when a write condition fails. PynamoDB already had part of the low-level request-construction seam, but model writes did not expose it for ordinarysave,update, anddeletecalls, and transactional delete did not support it. The existing validation also accepted normalReturnValuesvalues that DynamoDB does not allow forReturnValuesOnConditionCheckFailure.Solution
Expose condition-failure return values through model write APIs and table/low-level connection write APIs, while preserving the existing
PutError,UpdateError,DeleteError, andTransactWriteErrorbehavior. Returned old item data remains available through the wrapped botocore error response when DynamoDB includes it.Details
return_values_on_condition_failuretoModel.save().return_values_on_condition_failuretoModel.update()while preserving the existingReturnValues=ALL_NEWrequest behavior.return_values_on_condition_failuretoModel.delete().return_values_on_condition_failurethrough model save argument construction and table-scoped write methods.return_values_on_condition_failurethrough low-levelConnection.put_item,Connection.update_item, andConnection.delete_item.TransactWrite.delete()to acceptreturn_valuesand pass it asReturnValuesOnConditionCheckFailure.ReturnValuesOnConditionCheckFailurevalidation to DynamoDB’s allowed values:NONEandALL_OLD.Itemin the wrapped botocore error response for conditional write failures.Screenshots
N/A
Related Issues
N/A
Additional Notes
Verification completed with:
uv run pytest tests/test_model.py tests/test_table_connection.py tests/test_base_connection.py tests/test_transaction.py -k "return_values or condition or update or save or delete or preserves_error_response_item"uv run pytest tests/ -k "not ddblocal"uv run sphinx-build -W docs /tmp/docs-builduv run mypy .