aws-sdk-java icon indicating copy to clipboard operation
aws-sdk-java copied to clipboard

Remove updated attributes with AttributeTransformer before saving

Open stonekyx opened this issue 7 years ago • 4 comments

When saving an object with DynamoDBMapper, AttributeTransformer can be used to add new values to the item to be saved, or modify existing values, but the problem is that it cannot delete them. As long as an attribute is present and non-null in the initial object passed to DynamoDBMapper.save, it will always present in the saved item, regardless of the return value of AttributeTransformer.

Our use case is that, an attribute needs to be transformed into several values before saving, but the original attribute itself should disappear. The "disappear" step cannot be achieved with current implementation of DynamoDBMapper.

A possible way to solve this is to allow null values in the returned Map from AttributeTransformer, and these null values will be removed from updating attributes if present.

stonekyx avatar Jan 24 '19 13:01 stonekyx

This looks like a feature request. We are actively working on high level libraries for SDK v2 and not currently adding new features in v1 high level libraries. If you can send us a PR, we are happy to take a look

varunnvs92 avatar Feb 12 '19 19:02 varunnvs92

OK. It seems that the new SDK v2 doesn't have any clear plan for high level APIs right now, so I'll see if I can find some time to work on this in v1.

stonekyx avatar Feb 13 '19 06:02 stonekyx

Hi @debora-ito. Can I give this a try?

h-hub avatar Oct 18 '20 05:10 h-hub

This is a very old issue that is probably not getting as much attention as it deserves. We encourage you to check if this is still an issue in the latest release and if you find that this is still a problem, please feel free to provide a comment or open a new issue.

github-actions[bot] avatar Oct 18 '23 06:10 github-actions[bot]