This is how my table looks like:
toHash
is my primary partition key and timestamp
is the sort key.
So, when I am executing this code [For getting the reverse sorted list of timestamp
]:
import boto3 from boto3.dynamodb.conditions import Key, Attr
client = boto3.client('dynamodb')
response = client.query(
TableName='logs',
Limit=1,
ScanIndexForward=False,
KeyConditionExpression="toHash = :X",
)
I get the following error:
botocore.exceptions.ClientError: An error occurred (ValidationException) when calling the Query operation: Invalid KeyConditionExpression: An expression attribute value used in expression is not defined; attribute value: :X
Am I doing something wrong here? Why isn't X
considered a valid attribute value?
ExpressionAttributeValues
clause to the query to supply the value for:X
in the query. – garnaat