ds_provider_mock_py_lib.dataset.engines

File: __init__.py Region: ds_provider_mock_py_lib/dataset/engines

Dataset execution engines.

Submodules

Classes

ReadEngine

Execute mock reads including pagination, resume, and failure injection.

Package Contents

class ds_provider_mock_py_lib.dataset.engines.ReadEngine[source]

Execute mock reads including pagination, resume, and failure injection.

connection: ds_provider_mock_py_lib.linked_service.mock.MockBackend
settings: ds_provider_mock_py_lib.dataset.settings.MockDatasetSettings
dataset_name: str
provider_type: str
output: pandas.DataFrame
checkpoint: ds_provider_mock_py_lib.dataset.engines._read_checkpoint.Checkpoint
metadata: dict[str, Any]
_emitted_ops: list[str] = []
execute(checkpoint: dict[str, Any] | None = None) None[source]

Execute read flow and update output / checkpoint state.

Parameters:

checkpoint – Existing checkpoint state to continue from.

Raises:
  • ReadError – If settings are invalid or a wrapped backend failure occurs.

  • ConnectionError – If dataset-level injection is configured as a connection error.

  • MockBackendError – If the mock backend raises and the caller must wrap it.

_validate_settings() None[source]

Raise when settings cannot fulfil a read.

_resolve_start() tuple[int, int, bool][source]

Resolve batch, first page, and whether this call is a resume.

Returns:

(batch, first_page, resumed).

Raises:

ReadError – If a stored pagination cursor cannot be decoded.

_save_pagination(*, batch: int, page: int) None[source]

Persist pagination resume state without advancing the watermark.

_assign_output(pages: list[pandas.DataFrame]) None[source]

Assign concatenated pages to output, including rows already read on failure.

Parameters:

pages – Pages collected so far in this read.

_finish_complete(*, batch: int, pages: list[pandas.DataFrame], total_pages: int, resumed: bool) None[source]

Complete a successful read of the configured scope.

Parameters:
  • batch – Completed batch number written to the incremental watermark.

  • pages – Pages collected during this read.

  • total_pages – Page count for the current batch.

  • resumed – Whether this call continued from a pagination cursor.

_set_metadata(*, batch: int, total_pages: int, resumed: bool) None[source]

Populate engine metadata used by self.operation.metadata.

Parameters:
  • batch – Batch number that was read.

  • total_pages – Page count for the current batch.

  • resumed – Whether this call continued from a pagination cursor.

_inject_failure(details: dict[str, Any]) None[source]

Raise the configured dataset-level contract exception.

Parameters:

details – Page context attached to the raised exception.

Raises:
  • ConnectionError – When raise_as is connection_error.

  • ReadError – When raise_as is read_error.