Redshift Data Paginator misleading documentation for NextToken
when setting MaxItems
#4125
Labels
bug
This issue is a confirmed bug.
p2
This is a standard priority issue
pagination
service-api
This issue is caused by the service API, not the SDK implementation.
Describe the bug
Identified an issue with AWS Paginators, specifically using the GetStatementResult paginator from the AWS SDK for Python (Boto3) RedshiftDataAPIService. The primary concern is related to the expected behaviour of pagination when setting the
MaxItems
parameter in thePaginationConfig
dictionary. Contrary to the AWS documentation expectations, providing a value forMaxItems
inPaginationConfig
does not result in multiple items representing pages in thePageIterator
object when the total number of items is less than the available items and aNextToken
is not returned to resume pagination.Related issue:
NextToken
not returned when settingMaxItems
#3677Expected Behavior
In the GetStatementResult documentation, it states a
PaginationConfig
dict can be provide to control pagination, whereMaxItems
limits the total number of items to return, and if the total number of items available is more than the value specified in max-items then aNextToken
will be provided in the output that you can use to resume pagination.Current Behavior
The description of
MaxItems
andStartingToken
does not match the observed behaviour. When setting theMaxItems
to 1000, the expected behaviour is for the returned number of records to be the same as the setMaxItems
, and if the returned number of items is less than the total number of items available, aNextToken
will be provided in the output. From the code snippet below, aNextToken
is not returned and is not present in the response syntax in RedshiftDataAPIService.Paginator.GetStatementResult. We can verify this by comparingTotalNumRows
to the length ofresult['Records']
and viewing the response dictionary keys.In the linked issue, it specifies using
PageSize
in the pagination config and using aposition
token, howeverPageSize
is not a valid parameter andposition
ormarker
are not returned.Reproduction Steps
Possible Solution
When applying the
dir()
function to the iterator or looking at the code for PageIterator, propertyresume_token
is present. Using theresume_token
forStartingToken
inPaginationConfig
forPageIterator
will resume pagination. The newPageIterator
will include another value for theresume_token
property if there are more items available.Additional Information/Context
No response
SDK version used
Python 3.10, boto3 1.28.78
Environment details (OS name and version, etc.)
MacOS Sonoma 14.4.1
The text was updated successfully, but these errors were encountered: