I have the following source code to filter items from a DynamoDB.
...
session = boto3.session.Session()
db = session.resource('dynamodb', region_name=region, endpoint_url=endpoint)
self.table_obj = db.Table(table_name)
filter_expression = ':status_name <> :status_val'
attr_names = {'status_name': 'status'}
attr_values = {'status_val': 'UPDATED'}
response = table.query(FilterExpression=filter_expression,
ExpressionAttributeNames=attr_names,
ExpressionAttributeValues=attr_values)
However, I getting the following error:
ClientError: An error occurred (ValidationException) when calling the Query operation: ExpressionAttributeNames contains invalid key: Syntax error; key: "status_name"
I can't see anything wrong with the above code, am I missing something?