Skip to content
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

Add a condition expression when inserting into DynamoDB. #1147

Open
igormgomes opened this issue May 2, 2024 · 6 comments
Open

Add a condition expression when inserting into DynamoDB. #1147

igormgomes opened this issue May 2, 2024 · 6 comments
Assignees

Comments

@igormgomes
Copy link

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);
@magnuspedro
Copy link

I'm having the same issue. I looked up the doc and couldn't find anything. I had to use the same alternative as he did

@arielsapatelli
Copy link

arielsapatelli commented May 3, 2024

I had the same problem using the conditional expressions in dynamodb operations. It would be interesting to externalize this parameter.

@MatejNedic
Copy link
Member

Hey @igormgomes, thanks on reporting, I agree we should extend both operations and template with this. Are you willing to make contribution?

@igormgomes
Copy link
Author

Hey @MatejNedic, thanks for replying. Yes, I'm willing.

@MatejNedic
Copy link
Member

@igormgomes all yours :)

@aagrawal-ipsi-ghub
Copy link

aagrawal-ipsi-ghub commented May 31, 2024

@igormgomes Hi I am also facing same issue, are you working on it?

@MatejNedic MatejNedic assigned MatejNedic and unassigned igormgomes Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants