I am new to amazon web services. I want to retrieve all the entries in the dynamo DB table which have a particular word in their hash key. It is similar to using like operator in oracle DB. How can I do it? If its not possible, how do I retrieve all the entries in the table without giving any constraint on the hash key so that later I can iterate over all of them to match the word?
Please, do not think of DynamoDB as you would of MySQL. DynamoDB is only a key:value store with a couple of niceties.
The fundamental of key:value store is:
Either you know the key, and get your value;
Either you don't, and you get the whole table.
In DynamoDB specific case, you can
GetItem
hash_key
, possibly applying a filter, with Query
Scan
This said, Scan
is both slow and expensive. You should never use it otherwise your design is most probably wrong.
In your case, it sounds like you will want to split your key into a
hash_key
range_key
Then you could use Query
to get all the items sharing hash_key
. With Query
, you may apply filters like BEGINS_WITH
to narrow you scope.
Please note that all (hash_key
, range_key
) tuples needs to be unique.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With