Skip to content

Add a condition expression when inserting into DynamoDB. #1147

@igormgomes

Description

@igormgomes

Type: Feature

Is your feature request related to a problem? Please describe.
Is there a way to use a condition expression with DynamoDbOperations for inserting data, or do I need to create a separate implementation of DynamoDbTable, or should I just utilize the DynamoDbClient?

Describe the solution you'd like
Perhaps we can create another method and call it like this.

var conditionalCheck = new ConditionalCheck();
conditionalCheck.setExpression(expression);
dynamoDbOperations.save(entity, conditionalCheck);

Describe alternatives you've considered
I created an implementation using DynamoDbClient, and it worked.

val putItemRequest = PutItemRequest.builder()
            .tableName(tableName)
            .item(item)
            .conditionExpression("attribute_not_exists(my_sk)")
            .build();
dynamoDbClient.putItem(putItemRequest);

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions