dabla opened a new pull request, #75649: URL: https://github.com/apache/airflow/pull/75649
`KiotaRequestAdapterHook.paginated_run()` collects every page of a Microsoft Graph request in one list before it returns. A task that extracts a large collection (all users of a tenant, their group memberships, the deleted objects) therefore holds the whole dataset in memory, even when all it does with a page is write it away. This adds `KiotaRequestAdapterHook.iter_paginated_run()`, an async generator with the same parameters as `paginated_run()` that yields the pages one at a time: the caller handles a page before the next one is requested, so a collection of any size passes through in page-sized steps. The next page is resolved the same way (`pagination_function`, `default_pagination` by default) and every link still goes through `assert_allowed_host()` before it is fetched. `paginated_run()` now collects what `iter_paginated_run()` yields instead of running a loop of its own, so there is a single pagination loop. Its `pagination_function` keeps receiving `responses`, the callable returning the pages collected so far; `iter_paginated_run()` does not pass it, since nothing keeps the pages already yielded. We have run the same code as a monkey patch in production Dags that stream Entra ID objects to S3 page by page. Tests: five unit tests in `test_msgraph.py`. Four cover `iter_paginated_run()` (follows the next links, requests the next page only when asked, stops on an empty response, refuses a cross-host link before fetching it) and fail without the change. The fifth pins the `responses` callable that `paginated_run()` keeps handing to its `pagination_function`, so the delegation cannot drop it. --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes — Claude Code (Fable 5.1) Generated-by: Claude Code (Fable 5.1) following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
