Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws dynamodb query and aws dynamodb scan commands are missing docs for the --limit parameter #8859

Closed
dead10ck opened this issue Aug 9, 2024 · 7 comments
Assignees
Labels
bug This issue is a bug. closed-for-staleness dynamodb p3 This is a minor priority issue response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@dead10ck
Copy link

dead10ck commented Aug 9, 2024

Describe the bug

The dynamodb query and dynamodb scan subcommands both seem to respond to a --limit parameter by setting the Limit query parameter as expected; however, --limit is not documented at all in the help pages.

Expected Behavior

--limit should be documented

Current Behavior

It is not

Reproduction Steps

Run aws dynamodb query help

Possible Solution

No response

Additional Information/Context

No response

CLI version used

aws-cli/2.17.26 Python/3.11.9 Linux/6.5.0-45-generic exe/x86_64.ubuntu.22

Environment details (OS name and version, etc.)

Ubuntu 22.04

@dead10ck dead10ck added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Aug 9, 2024
@RyanFitzSimmonsAK RyanFitzSimmonsAK self-assigned this Aug 9, 2024
@RyanFitzSimmonsAK RyanFitzSimmonsAK added investigating This issue is being investigated and/or work is in progress to resolve the issue. dynamodb p3 This is a minor priority issue and removed needs-triage This issue or PR still needs to be triaged. labels Aug 9, 2024
@RyanFitzSimmonsAK
Copy link
Contributor

Hey @dead10ck, thanks for reaching out. AWS CLI obscures service pagination parameters like --limit in favor of the CLI pagination parameters (--max-items being the analog to --limit). This is done so that pagination in the CLI is consistent between services. However, the service pagination parameters still work, as you mentioned. Please let me know if you have any follow-up questions.

@RyanFitzSimmonsAK RyanFitzSimmonsAK added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. labels Aug 14, 2024
@dead10ck
Copy link
Author

But pagination doesn't serve the same purpose as limiting the results of a scan or query. When you --limit a query to 1, you are only charged RCUs for that one row; when you use --max-items, you are charged RCUs for I think the full result set? You can verify by checking the consumed RCUs.

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Aug 15, 2024
@RyanFitzSimmonsAK
Copy link
Contributor

You should be able to accomplish the same thing using a combination of --max-items and --page-size.

aws dynamodb scan --table-name testTable --limit 1

...
    "Count": 1,
    "ScannedCount": 1,
...

If using only --max-items, all items are scanned as you mentioned. aws dynamodb scan --table-name testTable --max-items 1

...
    "Count": 3,
    "ScannedCount": 3,
    "ConsumedCapacity": null,
    "NextToken": "eyJFeGNsdXNpdmVTdGFydEtleSI6IG51bGwsICJib3RvX3RydW5jYXRlX2Ftb3VudCI6IDF9"

Using both --max-items and page-size correctly restricts the number of scanned and returned items. aws dynamodb scan --table-name testTable --page-size 1 --max-items 1

...
    "Count": 1,
    "ScannedCount": 1,
    "ConsumedCapacity": null,
    "NextToken": "eyJFeGNsdXNpdmVTdGFydEtleSI6IHsiTmFtZSI6IHsiUyI6ICJDYW1teSJ9fX0="

@RyanFitzSimmonsAK RyanFitzSimmonsAK added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Aug 28, 2024
Copy link

github-actions bot commented Sep 7, 2024

Greetings! It looks like this issue hasn’t been active in longer than five days. We encourage you to check if this is still an issue in the latest release. In the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or upvote with a reaction on the initial post to prevent automatic closure. If the issue is already closed, please feel free to open a new one.

@github-actions github-actions bot added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Sep 7, 2024
@dead10ck
Copy link
Author

dead10ck commented Sep 8, 2024

Ah, you are right, thanks! Is that documented anywhere? That doesn't seem like an obvious way to use query limits with the CLI.

@github-actions github-actions bot removed closing-soon This issue will automatically close in 4 days unless further comments are made. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. labels Sep 8, 2024
@RyanFitzSimmonsAK
Copy link
Contributor

It's explained a bit in the description for page-size.

The size of each page to get in the AWS service call. This does not affect the number of items returned in the command’s output. Setting a smaller page size results in more calls to the AWS service, retrieving fewer items in each call.

--page-size 1 means that it will scan one item at a time until it reaches --max-items total items (in this case also one).

@RyanFitzSimmonsAK RyanFitzSimmonsAK added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Sep 11, 2024
Copy link

Greetings! It looks like this issue hasn’t been active in longer than five days. We encourage you to check if this is still an issue in the latest release. In the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or upvote with a reaction on the initial post to prevent automatic closure. If the issue is already closed, please feel free to open a new one.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Sep 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. closed-for-staleness dynamodb p3 This is a minor priority issue response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

2 participants