I'm coming from a relational database background and trying to work with amazon's DynamoDB
I have a table with a hash key "DataID" and a range "CreatedAt" and a bunch of items in it.
I'm trying to get all the items that were created after a specific date and sorted by date. Which is pretty straightforward in a relational database.
In DynamoDB the closest thing i could find is a query and using the range key greater than filter. The only issue is that to perform a query i need a hash key which defeats the purpose.
So what am I doing wrong? Is my table schema wrong, shouldn't the hash key be unique? or is there another way to query?
Approach I followed to solve this problem is by created a Global Secondary Index as below. Not sure if this is the best approach but hopefully if it is useful to someone.
Limitation imposed on the HTTP API user to specify the number of days to retrieve data, defaulted to 24 hr.
This way, I can always specify the HashKey as Current date's day and RangeKey can use > and < operators while retrieving. This way the data is also spread across multiple shards.