Error: ValidationException: Invalid KeyConditionExpression: Attribute name is a reserved keyword;
Answered by Rafal Wilinski
Solution
DynamoDB has a list of reserved keywords that you cannot use in your queries or scans directly. If you need to write an expression that contains one of them, you need to use ExpressionAttributeNames to replace reserved word with a placeholder. For example, this query with reserved keyword:
params = { TableName : ‘MY_TABLE’, FilterExpression: "timestamp BETWEEN :startDate AND :endDate", ExpressionAttributeValues: { ":startDate": ""+startDate, ":endDate": ""+endDate } }
Replace with:
params = { TableName : ‘MY_TABLE’, FilterExpression: "#dynobase_timestamp BETWEEN :startDate AND :endDate", ExpressionAttributeValues: { ":startDate": startDate, ":endDate": endDate }, ExpressionAttributeNames: { "#dynobase_timestamp": "timestamp" } }
Other Common DynamoDB Errors (with Solutions)
- AWS DynamoDB CredentialsError: Missing credentials in config
- appsync dynamodb not seeing all fields
- DynamoDB Internal Server Error
- amazon dynamodb query parentparams is not defined
- lambda function not triggering from dynamodb
- DynamoDB internal error
- aws.dynamodb.documentclient is not a constructor
- why is the GSI dynamodb not showing item count
- DynamoDB is already installed on a path
- DynamoDB stream lambda error
- could not unmarshal the value dynamodb
- DynamoDB Query Limit Not Working
- AWS CLI DynamoDB Error Parsing Parameter
- DynamoDB could not invoke null on class
- dynamodb cannot read property 's' of undefined
Better DynamoDB experience.
Try 7-day free trial. No strings attached.
Product Features
DynamoDB Tools
DynamoDB Info
© 2024 Dynobase