Skip to content

Conversation

cenedhryn
Copy link
Contributor

@cenedhryn cenedhryn commented Feb 16, 2022

Motivation and Context

The UpdateItem operation in DynamoDb Enhanced client creates native DDB UpdateExpression behind the scenes, letting users update and delete item properties. However, users cannot specify update expressions directly, limiting the number of use cases for the update operation.

With this change, users can now write their own UpdateExpressions in the context of the Extension framework, affecting item updates at a schema level and allowing users to customize features such as atomic operations on the database. For ease of use, this feature also includes an AtomicCounter annotation/tag that auto increments long values.

Modifications

The WriteModification class in the extension framework now has an updateExpression parameter that you can write to.

An UpdateExpression contains lists of the actions supported by DDB: SET, DELETE, REMOVE and ADD. The UpdateItem operation merges an UpdateExpression provided by the extensions with the one produced by calling updateItem with a supplied item, and then parses it into DDB syntax.

Testing

Unit testing, integration testing

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed
  • I have added a changelog entry. Adding a new entry must be accomplished by running the scripts/new-change script and following the instructions. Commit the new file created by the script in .changes/next-release with your changes.
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • I confirm that this pull request can be released under the Apache 2 license

UpdateExpression API
* Adds UpdateExpression to extensions as well as parsing into string

* Making merge UpdateExpressions static
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 7, 2022

SonarCloud Quality Gate failed.    Quality Gate failed

Bug E 4 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 93 Code Smells

72.6% 72.6% Coverage
4.8% 4.8% Duplication

@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 4 Code Smells

93.4% 93.4% Coverage
8.2% 8.2% Duplication

Copy link
Contributor

@joviegas joviegas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approved merge

@cenedhryn cenedhryn merged commit 30cc28a into master May 18, 2022
@cenedhryn cenedhryn deleted the feature/master/ddbenhanced-updateexpression branch May 18, 2022 17:52
aws-sdk-java-automation added a commit that referenced this pull request May 16, 2024
…207bc00e0

Pull request: release <- staging/1faa73e9-959f-4edd-808b-e6a207bc00e0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants