I'm still learning DynamoDB and I would like to get a single item from a table based on two unique attributes (tconst and primaryTitle) in the table. Both of those attributes have unique values for each row. The primaryKey is tconst and the sortKey is primaryTitle
I thought that I could do something like below:
aws dynamodb query \
--endpoint-url http://localhost:8000 \
--table-name title \
--key-condition-expression "tconst = :tconst" and "primaryTitle = :primaryTitle" \
--expression-attribute-values '{
":tconst":{"S":"xxxx"},
":primaryTitle":{"S":"something"}
}'
"Item": {
"tconst": {
"S": "xxxx"
},
"titleType": {
"S": "xxxx"
},
"primaryTitle": {
"S": "something"
},
"originalTitle": {
"S": "Travel Daze"
},
"isAdult": {
"S": "0"
},
"startYear": {
"S": "2019"
},
"endYear": {
"S": "\\N"
},
"runtimeMinutes": {
"S": "\\N"
},
"genres": {
"S": "\\N"
}
},
"Item": {
"tconst": {
"S": "yyyy"
},
"titleType": {
"S": "yyyy"
},
"primaryTitle": {
"S": "Travel Daze"
},
"originalTitle": {
"S": "Travel Daze"
},
"isAdult": {
"S": "0"
},
"startYear": {
"S": "2019"
},
"endYear": {
"S": "\\N"
},
"runtimeMinutes": {
"S": "\\N"
},
"genres": {
"S": "\\N"
}
}