ds_protocol_http_py_lib.dataset.pagination.settings

File: settings.py Region: ds_protocol_http_py_lib/dataset/pagination/settings

Pagination settings nests for HttpDataset read configuration.

Example

>>> PaginationSettings(
...     strategy=PaginationStrategy.OFFSET,
...     items_path="data",
...     offset=OffsetPaginationSettings(page_size=100, total_path="meta.total"),
... )

Attributes

StrategyConfig

Classes

OffsetPaginationSettings

Configuration for offset / limit pagination.

PageNumberPaginationSettings

Configuration for page-number / page-size pagination.

CursorPaginationSettings

Configuration for opaque cursor / token pagination.

PaginationSettings

Declared pagination mechanism and strategy-specific nests.

Module Contents

ds_protocol_http_py_lib.dataset.pagination.settings.StrategyConfig
class ds_protocol_http_py_lib.dataset.pagination.settings.OffsetPaginationSettings[source]

Bases: ds_common_serde_py_lib.Serializable

Configuration for offset / limit pagination.

offset_param: str = 'offset'

Query/body/header parameter name for the offset.

limit_param: str = 'limit'

Query/body/header parameter name for the page size.

page_size: int = 100

Number of records requested per page.

initial_offset: int = 0

Offset used for the first page when no checkpoint exists.

total_path: str | None = None

Optional body path to a total record count.

When the path resolves, a non-empty page stops once offset + len(items) >= total. The next offset advances by the rows returned, and the request still asks for page_size. An empty page stops immediately. A short page ends the read only when this path is unset or missing.

inject_location: ds_protocol_http_py_lib.utils.http.request.InjectLocation

Where offset and limit are injected on the request.

class ds_protocol_http_py_lib.dataset.pagination.settings.PageNumberPaginationSettings[source]

Bases: ds_common_serde_py_lib.Serializable

Configuration for page-number / page-size pagination.

page_param: str = 'page'

Parameter name for the page ordinal.

page_size_param: str = 'per_page'

Parameter name for the page size.

page_size: int = 100

Number of records requested per page.

start_page: int = 1

First page ordinal (0- or 1-based, must match the API).

total_pages_path: str | None = None

Optional body path to a total page count.

When the path resolves, a non-empty page stops on the last ordinal. An empty page stops immediately. A short page ends the read only when this path is unset or missing.

inject_location: ds_protocol_http_py_lib.utils.http.request.InjectLocation

Where page and page size are injected on the request.

class ds_protocol_http_py_lib.dataset.pagination.settings.CursorPaginationSettings[source]

Bases: ds_common_serde_py_lib.Serializable

Configuration for opaque cursor / token pagination.

cursor_path: str

Body path or header name where the next cursor is read.

cursor_source: ds_protocol_http_py_lib.dataset.pagination.enums.ExtractSource

Whether the cursor is extracted from the response body or a header.

cursor_param: str = 'cursor'

Parameter / header / body key used to inject the cursor.

cursor_location: ds_protocol_http_py_lib.utils.http.request.InjectLocation

Where the cursor is injected on the next request.

page_size_param: str | None = None

Optional page-size query parameter name (always injected as QUERY).

page_size: int | None = None

Optional requested page size (sent with page_size_param).

class ds_protocol_http_py_lib.dataset.pagination.settings.PaginationSettings[source]

Bases: ds_common_serde_py_lib.Serializable

Declared pagination mechanism and strategy-specific nests.

Provide the nest matching strategy (same pattern as auth nests on HttpLinkedServiceSettings). Other nests should be omitted from the payload; only the selected nest is read at runtime.

strategy: ds_protocol_http_py_lib.dataset.pagination.enums.PaginationStrategy

Pagination mechanism. Declared explicitly; never inferred.

max_pages: int | None = None

Optional client-side safety ceiling on pages fetched per read().

None (default) means no ceiling — keep paging until the strategy signals stop (short page, total count, empty cursor, …). Set an int only when you want a hard guard against runaway loops.

items_path: str = 'data'

Path to the record array used for paging control (stop / advance).

Use $ for a root array. Does not select what the deserializer sees. Each page frame is dataset.deserializer(response.content).

offset: OffsetPaginationSettings | None = None

Required when strategy is offset.

page_number: PageNumberPaginationSettings | None = None

Required when strategy is page_number.

cursor: CursorPaginationSettings | None = None

Required when strategy is cursor.

__post_init__() → None[source]
_selected_nest() → StrategyConfig | None[source]
property strategy_config: StrategyConfig

Strategy-specific nest for strategy (guaranteed by __post_init__).