[英]How do you use the LastEvaluatedKey as the ExclusiveStartKey in AWS CLI
我想顯示我通過 aws cli 查詢的特定表的所有結果,這就是我構建代碼的方式。
aws dynamodb scan --table-name core_samples --debug
這給了我一張桌子,但它沒有顯示我所有的結果。 所以我求助於分頁,我想知道如何從 LastEvaluatedKey 添加 ExclusiveStartKey 作為我的參數,這樣我就可以重新輸入代碼,直到我得到表格的所有結果。 以下是我認為我應該這樣做的方式,但它給了我一些錯誤。
aws dynamodb scan \
--table-name core_samples \
--ExclusiveStartKey <providedkey> \
--debug
或者
aws dynamodb scan \
--table-name core_samples \
--starting-token <providedkey> \
--debug
我該怎么做?
DynamoDB 的 AWS CLI 文檔位於https://docs.aws.amazon.com/cli/latest/reference/dynamodb/scan.html
使用 CLI,您不會獲得 LastEvaluatedKey,您會獲得 NextToken 並使用--starting-token
將其傳回。 model 遵循使用 CLI 跨服務的通用分頁系統,而不是特定於 DynamoDB 的:
--starting-token (string)
A token to specify where to start paginating. This is the NextToken
from a previously truncated response.
For usage examples, see Pagination in the AWS Command Line Interface
User Guide.
CLI 分頁文檔位於https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-pagination.html
它提到您也可以選擇進行客戶端分頁,比如使用less
這非常酷。 或者您可以將尋呼機設置為空,讓它自動尋呼並掃描直到完成。
AWS CLI 在 DynamoDB 中默認實現分頁,這與強制客戶端分頁的其他 SDK 不同。 這意味着您無需使用LastEvaluatedKey
或ExclusiveStartKey
除非您使用Limit
或FilterExpression
提前停止請求。
在這里你似乎沒有限制你的請求,所以我希望所有數據都被返回。 確保您使用 web 控制台檢查您的表數據,並了解它包含您期望從 CLI 命令獲得的項目。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.