简体   繁体   English

dynamodb FilterExpression返回意外数据

[英]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. 我正在使用boto3库进行FilterExpression,并在表中查找该表中有4个条目的用户名。 FilterExpression is returning only 1 record and LastEvaluationKey with unique_id in it. FilterExpression只返回1条记录和LastEvaluationKey,其中包含unique_id。 When I pass that unique_id to get more values for that user, I get different data set. 当我传递unique_id以获得该用户的更多值时,我获得了不同的数据集。

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. 当我看到响应并传递“LastEvaluationKey”的值时,我看到不同用户的不同数据集。

How can I get all rows for the user and not random data set? 如何获取用户的所有行而不是随机数据集? I can confirm that user has 4 records in dynamodb. 我可以确认用户在dynamodb中有4条记录。

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

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

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