#2980 feat: Support REST paginators that continue after receiving an empty page
Issue created by
edgarrmondragon
### Feature scope
Taps (catalog, state, tests, etc.)
### Description
The break is happening in
sdk/singer_sdk/streams/rest.py
Lines 462 to 475 in</meltano/sdk/commit/65575b5f72c9c3a69886a3805a07a61b7a72eb90|65575b5>
| try: |
| ------------------------------------------------------------ |
| first_record = next(records) |
| except StopIteration: |
|
self.logger.info( |
| "Pagination stopped after %d pages because no records were " |
| "found in the last response", |
| pages, |
| ) |
| break |
| yield first_record |
| yield from records |
| pages += 1 |
| |
| paginator.advance(resp) |
but we could do something like
try:
first_record = next(records)
except StopIteration:
if paginator.advance_if_empty(resp):
paginator.advance(resp)
continue
self.logger.info(
"Pagination stopped after %d pages because no records were "
"found in the last response",
pages,
)
break
## Related
•
#2318
meltano/sdk