-
Notifications
You must be signed in to change notification settings - Fork 856
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
Dynamo DB Mapper #35
Comments
Please consider supporting immutable classes in the mapper.
|
Please remove PaginatedList, and replace uses of it with Stream. java.util.List implementations are expected to have fast |
We're looking to make the automatic depagination provided by PaginatedList work for all service's paginated APIs with this story: #26. +1 to avoiding accidentally blowing up your memory and holding up a thread by using something as simple as |
One of the things I'd call out here is that I think there's a problem with the com.amazonaws.services.dynamodbv2.datamodeling.StandardBeanProperties method of reflecting over an object. Say I have:
In theory, even if DynamoDB only respects Sets, I should be able to handle the case where a setter allows a wider Collection type. It looks like this is because of line 140-146, the I think it should be checking if the return type has parent types, and if so trying to run up the tree. |
With the current DynamoDBMapper implementation, when performing scans, there's no easy way to make the scan operation respect the DynamoDB table's read throughputs. Please provide a scan operation that is able to respect a table's read throughput (whether by explicitly specifying a percentage of throughput to use or an absolute value of read units to use). |
Compatibility Between
|
Issue reported external to github: @DynamoDBGeneratedUuid does not work for nested list objects. @DynamoDBTable(tableName="XYZ")
class A {
@DynamoDBAttribute
List<B> listOfB;
}
@DynamoDBDocument
class B {
@DynamoDBGeneratedUuid(DynamoDBAutoGenerateStrategy.CREATE)
UUID id;
} |
Issue reported external to github: It would be nice to be able to annotate either the get method OR the type for type-specific annotations like @DynamoDBTypeConverted. Currently, the method has to be annotated. |
Issue reported external to github: We should support automatic conversion of non-string key values in maps. |
Issue reported external to github: DynamoDBMapper support for multiple conditions on same attribute for Save/Delete I should be able to do this without having to throw away DynamoDBMapper and using the API directly... expectedAttributes being a Map (DynamoDBSaveExpression.java and DynamoDBDeleteExpression) is a problem. It's a pretty common use case: "Upsert a record into DynamoDB as long as versionID < {myNewVersionId}" - to ensure not to override older records. This fails if the record doesn't yet exist, so the intuitive solution is to change the conditional expression to a list of two - versionId.exists(false) OR versionId.LE(myNewVersionID); This is simply not possible right now. I realize this is possibly because the conditions maps to a Legacy API (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.Expected.html), but unfortunately the new and more powerful Condition Expressions (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.ConditionExpressions.html) are not supported through DynamoDBMapper. So I suppose ultimately that's the request. Can DynamoDBMapper either support multiple conditions on the same attributes either via:
References of others with same problem: |
Issue reported external to github: DynamoDBMapper ignores inherited public getters from non-public classes If we have 2 classes A, and B extends A. Class A declares a property p with a public getter getP() (Annotated with @DynamoDBAttribute). Then a call is made to dynamoDBMapper.save() with an instance of class B, if class A was public, property p is persisted, but if class A was package-private, property p is ignored. Sample code that reproduces the issue :
Analysis : In simpler terms, when a public class inherits a package-private class, the Java compiler generates synthetic bridge methods for inherited public methods while it doesn't if the inherited class was public. |
I see that this issue is open yet. Do we have any support for this as of now? |
@bhaskarbagchi not yet. We plan on tackling the high level libraries shortly after we GA. We will update this issue as we have more information. |
Issue reported external to github: |
I know the mapper is a higher level interface and currently just returns the data object to keep things simple. Would it complicate the usage too much to instead return an object with the data object and metadata properties, or do we have to use the lower level API if we need those? Useful ones that I have run into would be:
Edit: I was just thinking about it, and save() returns void. It could return the old object instead, possibly on a flag in |
Related: #703 |
Not sure if anyone has mentioned it, but I'd like to see improved filter support for DynamoDBMapper in V2. My understanding is that there are two mechanisms for filtering right now: and The former is easier to program against but has limitations in its expressiveness. The latter solves this at the expense of generation. ExpressionSpecBuilder exists for the low-level client and can nearly be used directly with DynamoDBScanExpression, but has 1 major difference. DynamoDBScanExpression's withExpressionAttributeValues method takes Map<String, AttributeValue> where the *ExpressionSpec classes return Map<String, Object>. The Objects referred to there are the raw values, not AttributeValues. While that seems pretty close, I have not run across any exposed way to marshall from Object to AttributeValue. In this particular case, ConversionSchema contains all the necessarily logic to handle this marshalling but can't be leveraged due to the tight method access:
Even if such a toAttributeValue method did exist in this case, it would still feel rather clunky to have to map over each object in the ScanExpressionSpec's value map and marshall them myself. I'd be great to see withFilterExpression/withScanFilter get replaced with something more along the lines of withScanExpressionSpec for easy interop between DynamoDBMapper and DynamoDB. |
Repro confirmed. Opened #1748 |
Any updates on this? This is indeed a very common use-case and causes a lot of pain! |
When I try and parse this issue in the context of the new DynamoDB Enhanced Client we are currently previewing in v2 I'm not sure it applies. The design of the enhanced client, especially around how conditional statements are handled, is somewhat different to the v1 mapper but I don't understand the nuances of the v1 mapper and the issue as it is written here clearly enough to state with absolute certainty the issue is fixed. What I'd ask you to do is take a look at the new enhanced client in v2 and see if this issue is addressed, if not I will take another look. The new enhanced client does support the 'newer' conditional expression syntax provided by the DynamoDB API. |
Could we have an idea for when we will have have support for immutable objects? |
@mdamak I'm sorry this is such a big painpoint for you. We have a lot of other painpoints we're trying to address at this time, and our customer feedback shows those painpoints (like lack of TransferManager or Metrics in V2) are a lot higher priority for us to address. Once those are addressed, we definitely want to come back and add immutable support to the enhanced client. If you'd be willing to invest the time into implementing immutable support, we'd be willing to help you with the design and code reviews. |
Hi all, The wait is finally over and we'd like to announce the launch of the DynamoDB Enhanced Client for the AWS SDK for Java 2.0. https://github.com/aws/aws-sdk-java-v2/tree/master/services-custom/dynamodb-enhanced This client enhances every DynamoDb operation by providing direct mapping to and from your data classes without changing the nature of those interactions for a low-friction and intuitive development experience. If you'd like to learn about some of the other advantages this client offers, feel free to take a look at our launch blog: Now we've launched the work doesn't stop here. We've heard lots of great ideas that we haven't had time to implement. We will continue to build and improve this library as well as look at other AWS services that could benefit from enhanced clients of their own. As always we welcome your support, we hope the good ideas and contributions will keep coming! |
Is it possible to implement the @DynamoDBAutoGeneratedTimestamp annotation for the DynamoDB Enhanced Client? https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/dynamodbv2/datamodeling/DynamoDBAutoGeneratedTimestamp.html This is something I find very useful since all of my tables have "created" and "updated" timestamp attributes. Is there a way to do this with the EnhancedClient short of manually setting these fields on every write/update? |
The best way to do this in my opinion is to write it as an extension (see https://github.com/aws/aws-sdk-java-v2/blob/master/services-custom/dynamodb-enhanced/src/main/java/software/amazon/awssdk/enhanced/dynamodb/DynamoDbEnhancedClientExtension.java). This gives you the hooks you need to be able do exactly what this used to do in the v1 mapper, and you can even design your own annotations for it. For an example of how to write an extension like this, see the versioned record extension which is bundled by default : https://github.com/aws/aws-sdk-java-v2/blob/master/services-custom/dynamodb-enhanced/src/main/java/software/amazon/awssdk/enhanced/dynamodb/extensions/VersionedRecordExtension.java And to see how this extension uses custom annotations, take a look at : https://github.com/aws/aws-sdk-java-v2/blob/master/services-custom/dynamodb-enhanced/src/main/java/software/amazon/awssdk/enhanced/dynamodb/extensions/annotations/DynamoDbVersionAttribute.java Having said all that, if this all sounds like too much work this is a feature we will likely get around to doing ourselves assuming nobody submits a PR for it first. Thanks for +1'ing it. |
@bmaizels I'll give it a shot. If I have enough success I'll try to open a PR Thanks for the quick response! |
Immutables fans can now jump onto #1801 . We're going to start peeling off issues here with the goal of closing this issue once everyone's feedback and desires are accounted for in other places. |
We will be splitting this issue into the remaining open feature requests for the DynamoDbEnhancedClient. See the mentions above and below to follow-up on what issues you care about the most and +1 them! |
We think we've peeled off the remaining dynamodb-enhanced features here: dynamodb-enhanced We might have missed some, because there were many feature requests that were very v1-specific, but I believe we've gotten them all already. Please feel free to +1 the issues you want to put your vote behind us implementing (or ask on the issue if you want to take a stab at it yourself!). We'll be resolving this issue, now. |
I created an implementation of this extension via an annotation which acts the same way the @DynamoDBAutoGeneratedTimestamp in v 1.11 works. Feel free to modify and integrate into the SDK or anyone can use it at their own discretion. https://github.com/gakinson/dyanamodb-enhanced-DynamoDbAutoGeneratedTimestamp-annotation Thanks, |
Hello, I'm migrating a JAVA Lambda function from DynamoDB SDK 1 to DynamoDB SDK 2. With SDK 2 version, I use a model class with annotations to map this table, MODELTABLE : @DynamoDbPartitionKey I want to get rows in table with att2 = value. How can I make this?
Thanks in advance. |
Forget the request. I have found how to do it. ScanEnhancedRequest is the solution:
|
Hello, this solutions worked for me:
public <T> Iterator<T> getDataByAttributeValues (DynamoDbTable<T>
mapper, Map<String, AttributeValue> eav, String filterExpression) {
Expression scanExpression = Expression.builder()
.expression(filterExpression)
.expressionValues(eav)
.build();
ScanEnhancedRequest scanRequest =
ScanEnhancedRequest.builder().filterExpression(scanExpression).build();
return mapper.scan(scanRequest).items().iterator();
}
El lun., 19 oct. 2020 16:38, vitorbenedito <[email protected]>
escribió:
… Hi,
We had the same problem here. Is there a solution for this case?
As a solution, here we stop using DynamoDbAsyncIndex, and for do SGI
research we use DynamoDbAsyncClient directly, using
dynamoDbAsyncClient.query (r) ...
Using DynamoDbAsyncIndex, returns an SdkPublisher, and any problem
converting from dynamo, the thread is blocked and does not complete the
future.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#35 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ANNVW5WOEHSTZOOSRKJKWU3SLRFOPANCNFSM4DRSGO2A>
.
|
Hi Team, I have the two tables One is customer and other is Users Customer table is having the primary keys as cutsomerId and users table is having the primary key as userId I want to update the both table data by using the batchSave method. List objectsToWrite = Arrays.asList(cust, users); I tried with batchSave(objectsToWrite) But i am getting the below exception as Also in both tables i annotated the @DynamoDBTable |
Review the inherited state of V1 Dynamo DB mapper support and determine which changes are necessary for V2.
(Feel free to comment on this issue with desired changes).
The text was updated successfully, but these errors were encountered: