I was looking at DynamoDB to store some data because it looked like it might be a cost effective solution, but after a bit of research I think that it might not fit my use case because I am unable to find relevant unique values for partition and sort keys.
My data are a series of records of natural events for various species of plants e.g. the date and location that someone noticed a Beech tree's leaves appearing.
{
"species": "Beech",
"event": "Budburst",
"year": 2015,
"season": "Spring",
"date": "12/04/2015",
"latitude": "0.00000",
"longitude": "40.000"
}
The main query for the application would be to obtain all of the data for a certain species for a certain event in a certain year:
Endpoint: events/:species/:event-type/:year
This is likely to return a few thousand events which can then be shown in a map.
If this were MongoDB, then I might create an index on a composite field of species+eventType+year
. It wouldn't be a unique index, but at least only the few thousand results would be scanned rather than the whole table, so it wouldn't be too bad.
I'm not sure how to achieve the same thing in DynamoDB, though, or even if it is possible, because the partition key, or the partition + sort key combination seems to have to be unique.
Is the only way to make this work to have an incrementing unique event id for the partition key, and then have the species+eventType+year
string as the sort key?
If there are any other patterns I'd be grateful to hear about them.
Thanks for reading.