fe = "Attr('COLOR').eq('RED')"
我试着用
FilterExpression
要查询dynamoDB表,我要调用:
response = table.query(KeyConditionExpression=Key('key').eq(key),
FilterExpression=fe
)
但我得到了:
An error occurred (ValidationException) when calling the Query operation: Invalid FilterExpression: Syntax error; token: "'", near: "('COLOR"
是否可以将字符串作为
询问?它需要以字符串的形式输入,因为它是由字典输入的。我试着去掉一些引语,比如:
response = table.query(KeyConditionExpression=Key('key').eq(key),
FilterExpression=fe.replace('"', '')
)