我正在尝试使用 boto3 的低级客户端 api 查询 dynamodb。
response = client.query(
TableName='People',
IndexName='country-index',
KeyConditionExpression='country = :country',
FilterExpression="attribute_not_exists('age') AND attribute_not_exists('address')",
ExpressionAttributeValues={
":country":{"S": "USA"}
},
Limit=100
)
我收到语法错误:
An error occurred (ValidationException) when calling the Query operation: Invalid FilterExpression: Syntax error; token: "'", near: "('age"
boto3 中的文档重定向至 Amazon 开发人员指南。我无法找到 client.query(...) 的语法。那里列出的示例用于使用 table.query(...)
最佳答案
请按如下所述更改 FilterExpression
。
FilterExpression="attribute_not_exists(age) AND attribute_not_exists(address)",
关于python - 使用 boto3 dynamodb 客户端时出现 FilterExpression 语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43079957/