Question:
I have items with ItemID’s and Paths. ItemID is the partition key and Path is the range key. If I have multiple ItemID’s I want to query, but don’t want to include the range key is it possible to do it with batchGet
or will I have to use query
for each of the ItemID’s? I have tried batchGet
but get the error "The provided key element does not match the schema"
Answer:
No, it is not possible to get the items based on Partition key only. The batch get item API requires both Partition and Range key.
Keys – An array of primary key attribute values that define specific
items in the table. For each primary key, you must provide all of the
key attributes. For example, with a simple primary key, you only need
to provide the partition key value. For a composite key, you must
provide both the partition key value and the sort key value.
However, you can use Query API to get the data by partition key only.