ds_protocol_http_py_lib.dataset.incremental =========================================== .. py:module:: ds_protocol_http_py_lib.dataset.incremental .. autoapi-nested-parse:: **File:** ``__init__.py`` **Region:** ``ds_protocol_http_py_lib/dataset/incremental`` Incremental rulesets for Paginate (shifting-scope watermark instruction). Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/ds_protocol_http_py_lib/dataset/incremental/enums/index /autoapi/ds_protocol_http_py_lib/dataset/incremental/registry/index /autoapi/ds_protocol_http_py_lib/dataset/incremental/rules/index /autoapi/ds_protocol_http_py_lib/dataset/incremental/settings/index /autoapi/ds_protocol_http_py_lib/dataset/incremental/strategies/index /autoapi/ds_protocol_http_py_lib/dataset/incremental/watermark/index Classes ------- .. autoapisummary:: ds_protocol_http_py_lib.dataset.incremental.IncrementalStrategy ds_protocol_http_py_lib.dataset.incremental.IncrementalRules ds_protocol_http_py_lib.dataset.incremental.IncrementalSettings ds_protocol_http_py_lib.dataset.incremental.NoIncrementalRules ds_protocol_http_py_lib.dataset.incremental.WatermarkRules Functions --------- .. autoapisummary:: ds_protocol_http_py_lib.dataset.incremental.get_rules ds_protocol_http_py_lib.dataset.incremental.register Package Contents ---------------- .. py:class:: IncrementalStrategy Bases: :py:obj:`enum.StrEnum` Declared incremental rulesets supported by Paginate. .. py:attribute:: WATERMARK :value: 'watermark' Param-injected high-watermark across runs. .. py:function:: get_rules(strategy: ds_protocol_http_py_lib.dataset.incremental.enums.IncrementalStrategy) -> ds_protocol_http_py_lib.dataset.incremental.rules.IncrementalRules Resolve a registered incremental ruleset. :raises KeyError: If no ruleset is registered for ``strategy``. .. py:function:: register(strategy: ds_protocol_http_py_lib.dataset.incremental.enums.IncrementalStrategy) -> collections.abc.Callable[[T], T] 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. .. py:class:: IncrementalRules Bases: :py:obj:`abc.ABC` Shifting-scope rules for a paginated read. Instruction lives in ``IncrementalSettings``; state lives in ``checkpoint``. .. py:method:: 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 :abstractmethod: Apply persisted resume state to the outbound request snapshot. .. py:method:: commit(checkpoint: dict[str, Any], output: pandas.DataFrame, settings: ds_protocol_http_py_lib.dataset.incremental.settings.IncrementalSettings | None) -> None :abstractmethod: Advance persisted resume state after a fully successful drain. Does not clear ``checkpoint["pagination"]`` — that is owned by Paginate. .. py:class:: IncrementalSettings Bases: :py:obj:`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. .. py:attribute:: strategy :type: ds_protocol_http_py_lib.dataset.incremental.enums.IncrementalStrategy Incremental ruleset. Declared explicitly; never inferred. .. py:attribute:: param :type: str Name injected into the next run's request (query, header, or body key). .. py:attribute:: location :type: ds_protocol_http_py_lib.utils.http.request.InjectLocation Where the watermark is injected on the request. .. py:attribute:: watermark_path :type: str Dotted path on each output row used to compute the new high-watermark. .. py:class:: NoIncrementalRules Bases: :py:obj:`ds_protocol_http_py_lib.dataset.incremental.rules.IncrementalRules` Skip prepare/commit when incremental settings are absent. .. py:method:: 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 Apply persisted resume state to the outbound request snapshot. .. py:method:: commit(checkpoint: dict[str, Any], output: pandas.DataFrame, settings: ds_protocol_http_py_lib.dataset.incremental.settings.IncrementalSettings | None) -> None Advance persisted resume state after a fully successful drain. Does not clear ``checkpoint["pagination"]`` — that is owned by Paginate. .. py:class:: WatermarkRules Bases: :py:obj:`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. .. py:method:: 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 Apply persisted resume state to the outbound request snapshot. .. py:method:: commit(checkpoint: dict[str, Any], output: pandas.DataFrame, settings: ds_protocol_http_py_lib.dataset.incremental.settings.IncrementalSettings | None) -> None Advance persisted resume state after a fully successful drain. Does not clear ``checkpoint["pagination"]`` — that is owned by Paginate. .. py:method:: _is_missing_scalar(value: Any) -> bool :staticmethod: True for ``None`` and pandas-missing scalars (``NaN``, ``NaT``, ``NA``).