I have a dynamodb table with string primary key called name
and number sort key age
. I want to get the items in the dynamodb table with age
younger than 30. I understand that since my filter is on a Key, I can use query instead of scan.
So I tried: response = table.query( KeyConditionExpression=Key('age').lt(decimal.Decimal(30)) ) response
But this returns the response:
ClientError: An error occurred (ValidationException) when calling the Query operation: Query condition missed key schema element: name
So it looks like i need to provide a partition key for queries? Does this mean I can only make queries for age given a name?
What is the code to do this in boto3?