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

get_cost_and_usage method pagination #4391

Closed
2 tasks
peixeirodata opened this issue Jan 15, 2025 · 1 comment
Closed
2 tasks

get_cost_and_usage method pagination #4391

peixeirodata opened this issue Jan 15, 2025 · 1 comment
Assignees
Labels
costexplorer A low-level client representing AWS Cost Explorer Service feature-request This issue requests a feature. p3 This is a minor priority issue service-api This issue is caused by the service API, not the SDK implementation.

Comments

@peixeirodata
Copy link

Describe the feature

get_cost_and_usage method returns a 'NextPageToken' field in the response body, but when using the test paginator as below an OperationNotPageableError is raised:

import boto3

client = boto3.client(
                      'ce',
                      aws_access_key_id = '<KEY_ID>',
                      aws_secret_access_key = '<KEY_SECRET>')

params = {"TimePeriod": {"Start": "2024-06-01", "End": "2024-12-31"},
          "Granularity": "DAILY",
          "Metrics": ["UNBLENDED_COST", "USAGE_QUANTITY"],
          "GroupBy": [{"Type": "DIMENSION", "Key": "SERVICE"}, {"Type": "DIMENSION", "Key": "USAGE_TYPE"}]}

paginator = client.get_paginator('get_cost_and_usage')

for page in paginator.paginate(**params):
    print(page)

Use Case

Retrieve a wide range of dates with this method

Proposed Solution

No response

Other Information

I checked this document and this indicates me that the paginator is not implemented for this method:
https://github.com/boto/botocore/blob/master/botocore/data/ce/2017-10-25/paginators-1.json

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

SDK version used

boto3 1.35.99

Environment details (OS name and version, etc.)

Databricks environment

@peixeirodata peixeirodata added feature-request This issue requests a feature. needs-triage This issue or PR still needs to be triaged. labels Jan 15, 2025
@RyanFitzSimmonsAK RyanFitzSimmonsAK self-assigned this Jan 15, 2025
@RyanFitzSimmonsAK RyanFitzSimmonsAK added service-api This issue is caused by the service API, not the SDK implementation. p3 This is a minor priority issue costexplorer A low-level client representing AWS Cost Explorer Service and removed needs-triage This issue or PR still needs to be triaged. labels Jan 15, 2025
@RyanFitzSimmonsAK
Copy link
Contributor

Hi @peixeirodata, thanks for reaching out. I've recently reached out to the Cost Explorer service team about adding several paginators, including GetCostAndUsage. You can see that issue here. I'll be closing this issue as a duplicate. Please refer to an SDK or AWS CLI changelog for updates about this going forward. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
costexplorer A low-level client representing AWS Cost Explorer Service feature-request This issue requests a feature. p3 This is a minor priority issue service-api This issue is caused by the service API, not the SDK implementation.
Projects
None yet
Development

No branches or pull requests

2 participants