I have a dynamodb table with partition keys and range keys in the partition. Which query/expression do I need to write to get all the keys in a partition (using AWS api)?
Dos this do what you want? (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/SQLtoNoSQL.ReadData.Query.html)
// Return all of the songs by an artist
{
TableName: "Music",
KeyConditionExpression: "Artist = :a",
ExpressionAttributeValues: {
":a": "No One You Know"
}
}I managed to figure it out by looking at the query sent by AWS console in the network inspector 🙃
{:op :Query
:request {:ExpressionAttributeNames {"#kn0" "primaryKey"
"#kn1" "rangeKey"}
:ExpressionAttributeValues {":kv0" {:S "keyValue"}
":kv1" {:S "prefix"}}
:KeyConditionExpression "#kn0 = :kv0 and begins_with(#kn1, :kv1)"
:Limit 50
:ReturnConsumedCapacity "TOTAL"
:Select "ALL_ATTRIBUTES"
:TableName "TableName"}}
kn# are key names, put actual key names in the document, kv# are their values