ds_protocol_graphql_py_lib.dataset.pagination.settings¶
File: settings.py
Region: ds_protocol_graphql_py_lib/dataset/pagination/settings
Pagination settings nests for GraphqlDataset read configuration.
- Example (Visma Business NXT style,
pageInfo.endCursor): >>> PaginationSettings( ... strategy=PaginationStrategy.CURSOR, ... items_path="data.useCompany.associate.items", ... cursor=CursorPaginationSettings( ... cursor_path="data.useCompany.associate.pageInfo.endCursor", ... has_next_path="data.useCompany.associate.pageInfo.hasNextPage", ... ), ... )
- Example (Xledger style, cursor on last edge):
>>> PaginationSettings( ... strategy=PaginationStrategy.CURSOR, ... items_path="data.customers.edges", ... cursor=CursorPaginationSettings( ... cursor_path="data.customers.edges.-1.cursor", ... has_next_path="data.customers.pageInfo.hasNextPage", ... ), ... )
Classes¶
Configuration for cursor pagination via GraphQL variables. |
|
Declared pagination mechanism and strategy-specific nest. |
Module Contents¶
- class ds_protocol_graphql_py_lib.dataset.pagination.settings.CursorPaginationSettings[source]¶
Bases:
ds_common_serde_py_lib.SerializableConfiguration for cursor pagination via GraphQL variables.
- cursor_path: str¶
Dotted path on the full response body to the next cursor.
Examples:
data.x.pageInfo.endCursor(RelayendCursor), ordata.x.edges.-1.cursorfor the cursor on the last edge when the API has noendCursor(e.g. Xledger).-1is the last list element; on an empty page it resolves to no cursor.
- cursor_variable: str = 'after'¶
GraphQL variable that receives the cursor.
- page_size_variable: str | None = 'first'¶
GraphQL variable that receives the page size.
Noneto not send one.
- page_size: int | None = 100¶
Requested page size. Never clamped; server rejections surface as errors.
- has_next_path: str | None = None¶
Optional path on the full response to a boolean “more pages” flag (e.g.
data.x.pageInfo.hasNextPage).When set, traversal stops when it is
false. When unset, traversal stops on an empty page or a missing / empty next cursor.
- class ds_protocol_graphql_py_lib.dataset.pagination.settings.PaginationSettings[source]¶
Bases:
ds_common_serde_py_lib.SerializableDeclared pagination mechanism and strategy-specific nest.
Provide the nest matching
strategy. Absence ofPaginationSettingsonGraphqlReadSettingsmeans a single request.- strategy: ds_protocol_graphql_py_lib.dataset.pagination.enums.PaginationStrategy¶
Pagination mechanism. Declared explicitly; never inferred.
- items_path: str¶
Path on the full response to the page’s record list, used for paging control (empty-page checks). Missing or null is an error. Also the default
records_pathfor output when that is unset.
- max_pages: int | None = None¶
Optional safety ceiling on pages fetched per
read(). Exceeding it raises.Counted per call: a read that resumes from
checkpoint["pagination"]may fetch up tomax_pagesmore pages, so a large source drains over several runs.
- cursor: CursorPaginationSettings | None = None¶
Required when
strategyiscursor.
- _selected_nest() CursorPaginationSettings | None[source]¶
- property strategy_config: CursorPaginationSettings¶
Strategy-specific nest for
strategy(guaranteed by__post_init__).