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

Implement DynamoDB Auto Increment and Atomic Counter Annotations #66

Open
darkmastermindz opened this issue Jul 31, 2020 · 1 comment
Open

Comments

@darkmastermindz
Copy link

darkmastermindz commented Jul 31, 2020

Requesting an enhancement for Dynamo DB Data Repository given variable annotated with @DynamoDBHashKey, would like to see an annotation that is @DynamoDBAutoIncrement on an integer variable where multiple instances of the same @DynamoDBHashKey can be available.

Expected Behavior

This is different use case from updating an item, rather the data pattern of putting the same item key with incremented values on a attribute, i.e. same object but different versioning (Although @DynamoDBAtomicCounter which could be another good add for an annotation as well
see: https://linuxacademy.com/blog/linux-academy/dynamodb-atomic-counters/).

e.g.
Suppose there's a customer with orders that earn points when purchasing x item and there's multiple order numbers under the same customer hash key, but the history of all points must be kept. This way, we can query the primary key (the customer) and the order number and the total count of orders made in history.

https://stackoverflow.com/questions/38193431/auto-increment-counter-in-dynamo-db

@darkmastermindz darkmastermindz changed the title Enhancement: DynamoDB Auto Increment and Atomic Counters Implement DynamoDB Auto Increment and Atomic Counter Annotations Jul 31, 2020
@boostchicken
Copy link
Owner

I don't think going with an integer is a great idea with dynamodb. Due to how its indexing works (sort of a b-tree) you should always use a GUID to make sure that paritions are evenly spaces.

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

2 participants