简体   繁体   中英

dynamodb FilterExpression returns unexpected data

I am doing FilterExpression with boto3 library and looking for a username in a table that has 4 entries in that table. FilterExpression is returning only 1 record and LastEvaluationKey with unique_id in it. When I pass that unique_id to get more values for that user, I get different data set.

def lambda_handler(event,context):
    username="john"
    response = emp_info.scan(
        FilterExpression=Attr('username').eq(username)
    )
    print response

and when I see response and pass the value of "LastEvaluationKey", I see a different data set for different user.

How can I get all rows for the user and not random data set? I can confirm that user has 4 records in dynamodb.

因此,如果我以递归方式将用户名和“LastEvaluatedKey”传递给函数,它将返回所有数据,然后通过链接,我可以获得完整列表。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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