-
Notifications
You must be signed in to change notification settings - Fork 909
Is there any solution like ItemUtils.java in dynamodb aws-sdk-java v1 #1975
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
There's no equivalent to ItemUtils in v2 because the way attributes are mapped in the DynamoDB Enhanced client has changed. If you know the types you're working with, you can write an equivalent to ItemUtils using the DefaultAttributeConverterProvider.
If you need "dynamic" type discovery, you'd need to use a wrapper that dynamically selects the converter type. |
@debora-ito Is there any sample code about dynamic type discovery ?
|
@pkgonan it would be something similar to the answer in the stackoverflow link you referenced in the description. I'll go ahead and close this. Feel free to reach out if you have further questions. |
I'm sorry, this explanation doesn't make sense. This stack overflow answer describes a way of accomplishing this which is exactly what ItemUtils used to do in the V1 SDK. In fact, you used to have an ItemUtils implementation in the V2 SDK, that you have subsequently removed from your tests. Can you please explain why an ItemUtils implementation is not technically possible for the V2 SDK, because I believe it is and you're choosing not to implement it for an unknown reason. |
I don't see why converting a Map<String, AttributeValue> to Map<String, Object> can't be supported out of the box. For my use cases this is a significant degradation from v1 to v2, now that we have to write and maintain this missing core feature in house. |
Another vote to bring this back if possible. Much needed feature. |
We are considering implementing a v2 ItemUtils equivalent, but we need your help to better understand its use cases. Please follow my comment in #2628 and share what you'd like to see in the v2 ItemUtils. |
…064d36819 Pull request: release <- staging/b4c6a405-f096-4f46-a8da-144064d36819
I created a method, I hope it helps u:
And when you get the map, to pass it to json just:
Enjoy ;) |
it's amazing that this was never resolved. i came up with this for testing purposes. i have many custom dynamo and jackson converters and wanted to look at the raw values that were saved in dynamo to ensure that the converters work as expected.
|
Uh oh!
There was an error while loading. Please reload this page.
Describe the Feature
I want to converter Map<String, AttributeValue> -> Map<String, Object>.
aws-sdk-java v1 provides ItemUtils.java for this feature, but v2 did not.
Is there any solution about that ?
[ItemUtils.java in v1]
https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/dynamodbv2/document/ItemUtils.html#toSimpleMapValue-java.util.Map-
Is your Feature Request related to a problem?
Many people needs this feature.
https://stackoverflow.com/questions/57280071/equivalent-of-itemutils-toattributevalue-in-dynamodb-jdk-2-x
awsdocs/aws-doc-sdk-examples#889
Describe alternatives you've considered
Changing database.
The text was updated successfully, but these errors were encountered: