简体   繁体   English

使用boto3 dynamodb客户端的FilterExpression语法错误

[英]FilterExpression Syntax error using boto3 dynamodb client

I am trying to query dynamodb using the low-level client api of boto3. 我正在尝试使用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
    )

I get a syntax error : 我收到语法错误:

An error occurred (ValidationException) when calling the Query operation: Invalid FilterExpression: Syntax error; 调用Query操作时发生错误(ValidationException):Invalid FilterExpression:语法错误; token: "'", near: "('age" 令牌:“'”,附近:“('age”

The documentation in boto3 redirects to Amazon developer guide. boto3中的文档重定向到Amazon开发人员指南。 I was not able to find the syntax for client.query(...). 我找不到client.query(...)的语法。 The examples listed there are for using table.query(...) 列出的示例是使用table.query(...)

请如下所述更改FilterExpression

FilterExpression="attribute_not_exists(age) AND attribute_not_exists(address)",

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM