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

DynamoDB Enhanced: Support other java.time types

Open chrylis opened this issue 2 years ago • 1 comments

Describe the feature

As of 2.21.25, the DynamoDB Enhanced client supports out-of-the-box a large portion of the java.time value types, such as Instant, LocalTime, and even ZoneId. However, there are some other types that do not have built-in converters.

Use Case

I am writing a table to track usage for billing purposes, and one of my columns is the billing month, represented in Java code by java.time.YearMonth. The naive string representation is simply "YYYY-mm", which is exactly what I want in my column, but YearMonth can't be mapped without extra configuration.

Proposed Solution

Add converters for all remaining java.time value types, particularly including:

  • Month
  • MonthDay
  • Period
  • Year
  • YearMonth

All of these types have simple, clearly-defined ISO-8601 representations that are their native defaults.

Other Information

No response

Acknowledgements

  • [x] I may be able to implement this feature request
  • [ ] This feature might incur a breaking change

AWS Java SDK version used

2.21.25

JDK version used

openjdk version "11.0.18" 2023-01-17

Operating System and version

Gentoo Linux

chrylis avatar Nov 17 '23 20:11 chrylis

It looks like converters for MonthDay and Period are already available - https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/enhanced/dynamodb/internal/converter/attribute/package-summary.html

I know this is an ask for out-of-the-box support for those other converters, but as a reminder you can provide your own Attribute Converters - https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/ddb-en-client-adv-features-conversion.html

debora-ito avatar Jul 31 '24 18:07 debora-ito