You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Pynamodb中last_evaluated_key始终返回null的问题求助

Pynamodb查询last_evaluated_key始终返回null的问题

我正在使用Pynamodb与Dynamodb交互,明明存在多条数据,但last_evaluated_key始终返回null。

执行的查询代码:

results = RecruiterProfileModel.profile_index.query(
        hash_key=UserEnum.RECRUITER,
        scan_index_forward=False,
        limit=1,
    )

尝试获取以下值时:

results.last_evaluated_key

它始终返回null。但序列化results对象后,能看到其中的page_iter包含_last_evaluated_key:

{"page_iter": {"_operation": {}, "_args": ["recruiter"], "_kwargs": {"range_key_condition": null, "filter_condition": null, "index_name": "PROFILE_INDEX", "exclusive_start_key": {"sk": {"S": "PROFILE#6ab0f5bc-7283-4236-9e37-ea746901d19e"}, "user_type": {"S": "recruiter"}, "created_at": {"N": "1677398017.685749"}, "pk": {"S": "RECRUITER#6ab0f5bc-7283-4236-9e37-ea746901d19e"}}, "consistent_read": false, "scan_index_forward": false, "limit": 1, "attributes_to_get": null}, "_last_evaluated_key": {"sk": {"S": "PROFILE#95a4f201-2475-45a7-b096-5167f6a4d639"}, "user_type": {"S": "recruiter"}, "created_at": {"N": "1677398017.68518"}, "pk": {"S": "RECRUITER#95a4f201-2475-45a7-b096-5167f6a4d639"}}, "_is_last_page": false, "_total_scanned_count": 2, "_rate_limiter": null, "_settings": {"extra_headers": null}}, "_map_fn": {}, "_limit": 0, "_total_count": 1, "_index": 1, "_count": 1, "_items": [{"company_name": {"S": "fletcher-rodriguez"}, "created_at": {"N": "1677398017.685749"}, "last_name": {"S": "craig"}, "first_name": {"S": "tyler"}, "designation": {"S": "manager"}, "verification_status": {"S": "pending"}, "sk": {"S": "PROFILE#6ab0f5bc-7283-4236-9e37-ea746901d19e"}, "user_type": {"S": "recruiter"}, "email": {"S": "fowlerkathy@hernandez.com"}, "pk": {"S": "RECRUITER#6ab0f5bc-7283-4236-9e37-ea746901d19e"}}]}

该键明确存在,急需解决方法,感谢帮助。

编辑补充:
尝试多种方式获取last_evaluated_key,结果均返回null。


内容的提问来源于Stack Exchange,提问作者Koushik Das

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.30 05:03:26