ds_protocol_http_py_lib.dataset.incremental

File: __init__.py Region: ds_protocol_http_py_lib/dataset/incremental

Incremental rulesets for Paginate (shifting-scope watermark instruction).

Submodules

Classes

IncrementalStrategy

Declared incremental rulesets supported by Paginate.

IncrementalRules

Shifting-scope rules for a paginated read.

IncrementalSettings

Instruction nest for incremental rules used by Paginate.

NoIncrementalRules

Skip prepare/commit when incremental settings are absent.

WatermarkRules

Resume on a caller-persisted high-watermark.

Functions

get_rules(...)

Resolve a registered incremental ruleset.

register(→ collections.abc.Callable[[T], T])

Class decorator that registers an incremental ruleset.

Package Contents

class ds_protocol_http_py_lib.dataset.incremental.IncrementalStrategy[source]

Bases: enum.StrEnum

Declared incremental rulesets supported by Paginate.

WATERMARK = 'watermark'

Param-injected high-watermark across runs.

ds_protocol_http_py_lib.dataset.incremental.get_rules(strategy: ds_protocol_http_py_lib.dataset.incremental.enums.IncrementalStrategy) → ds_protocol_http_py_lib.dataset.incremental.rules.IncrementalRules[source]

Resolve a registered incremental ruleset.

Raises:

KeyError – If no ruleset is registered for strategy.

ds_protocol_http_py_lib.dataset.incremental.register(strategy: ds_protocol_http_py_lib.dataset.incremental.enums.IncrementalStrategy) → collections.abc.Callable[[T], T][source]

Class decorator that registers an incremental ruleset.

Adding a new ruleset is backward compatible: register a new enum member and handler module without changing Paginate.

class ds_protocol_http_py_lib.dataset.incremental.IncrementalRules[source]

Bases: abc.ABC

Shifting-scope rules for a paginated read.

Instruction lives in IncrementalSettings; state lives in checkpoint.

abstractmethod prepare(request: ds_protocol_http_py_lib.utils.http.request.RequestSnapshot, checkpoint: dict[str, Any], settings: ds_protocol_http_py_lib.dataset.incremental.settings.IncrementalSettings | None) → ds_protocol_http_py_lib.utils.http.request.RequestSnapshot[source]

Apply persisted resume state to the outbound request snapshot.

abstractmethod commit(checkpoint: dict[str, Any], output: pandas.DataFrame, settings: ds_protocol_http_py_lib.dataset.incremental.settings.IncrementalSettings | None) → None[source]

Advance persisted resume state after a fully successful drain.

Does not clear checkpoint["pagination"] — that is owned by Paginate.

class ds_protocol_http_py_lib.dataset.incremental.IncrementalSettings[source]

Bases: ds_common_serde_py_lib.Serializable

Instruction nest for incremental rules used by Paginate.

Instruction (stable): which request slot carries the lower bound and which response field advances the high-watermark.

State (runtime): the watermark value itself lives in checkpoint, owned by the caller. Paginate reads it on prepare and writes it on commit.

strategy: ds_protocol_http_py_lib.dataset.incremental.enums.IncrementalStrategy

Incremental ruleset. Declared explicitly; never inferred.

param: str

Name injected into the next run’s request (query, header, or body key).

location: ds_protocol_http_py_lib.utils.http.request.InjectLocation

Where the watermark is injected on the request.

watermark_path: str

Dotted path on each output row used to compute the new high-watermark.

class ds_protocol_http_py_lib.dataset.incremental.NoIncrementalRules[source]

Bases: ds_protocol_http_py_lib.dataset.incremental.rules.IncrementalRules

Skip prepare/commit when incremental settings are absent.

prepare(request: ds_protocol_http_py_lib.utils.http.request.RequestSnapshot, checkpoint: dict[str, Any], settings: ds_protocol_http_py_lib.dataset.incremental.settings.IncrementalSettings | None) → ds_protocol_http_py_lib.utils.http.request.RequestSnapshot[source]

Apply persisted resume state to the outbound request snapshot.

commit(checkpoint: dict[str, Any], output: pandas.DataFrame, settings: ds_protocol_http_py_lib.dataset.incremental.settings.IncrementalSettings | None) → None[source]

Advance persisted resume state after a fully successful drain.

Does not clear checkpoint["pagination"] — that is owned by Paginate.

class ds_protocol_http_py_lib.dataset.incremental.WatermarkRules[source]

Bases: ds_protocol_http_py_lib.dataset.incremental.rules.IncrementalRules

Resume on a caller-persisted high-watermark.

Reads checkpoint["incremental"]["watermark"] on prepare. On commit, advances it to the max present value at settings.watermark_path across rows. Pandas-missing scalars (NaN, NaT, NA) are ignored. Does not clear pagination state — Paginate owns that.

prepare(request: ds_protocol_http_py_lib.utils.http.request.RequestSnapshot, checkpoint: dict[str, Any], settings: ds_protocol_http_py_lib.dataset.incremental.settings.IncrementalSettings | None) → ds_protocol_http_py_lib.utils.http.request.RequestSnapshot[source]

Apply persisted resume state to the outbound request snapshot.

commit(checkpoint: dict[str, Any], output: pandas.DataFrame, settings: ds_protocol_http_py_lib.dataset.incremental.settings.IncrementalSettings | None) → None[source]

Advance persisted resume state after a fully successful drain.

Does not clear checkpoint["pagination"] — that is owned by Paginate.

static _is_missing_scalar(value: Any) → bool[source]

True for None and pandas-missing scalars (NaN, NaT, NA).