DynamoDB: KeyConditionExpression to check if an attribute exists or not null

Viewed 8786

I am using boto3 to query DynamoDB. And I have heard that table.query() is more efficient that table.scan() I was wondering if there is a way to check if the value exists using query() method?

response = table.scan(
        FilterExpression=Attr('attribute').exists()

If it is not possible to check using query() is there any other method that is more efficient than scan()?

This question is not a duplicate - I am looking for a way to optimize querying for existing/non existing attributes of query() or scan()

1 Answers
Related