ds_provider_mock_py_lib.dataset¶
File: __init__.py
Region: ds_provider_mock_py_lib/dataset
Mock Dataset
This module implements a read-only synthetic dataset for e2e testing.
Example
>>> from uuid import uuid4
>>> from ds_provider_mock_py_lib.dataset import MockDataset, MockDatasetSettings
>>> from ds_provider_mock_py_lib.linked_service import MockLinkedService, MockLinkedServiceSettings
>>> linked_service = MockLinkedService(
... id=uuid4(),
... name="mock-ls",
... version="1.0.0",
... settings=MockLinkedServiceSettings(),
... )
>>> dataset = MockDataset(
... id=uuid4(),
... name="mock-ds",
... version="1.0.0",
... linked_service=linked_service,
... settings=MockDatasetSettings(row_count=5),
... )
>>> linked_service.connect()
>>> dataset.read()
>>> data = dataset.output
Submodules¶
Classes¶
Read-only tabular dataset that emits deterministic synthetic rows. |
|
One synthetic column in a mock dataset. |
|
Settings that define mock read scope and injected failure behaviour. |
Package Contents¶
- class ds_provider_mock_py_lib.dataset.MockDataset[source]¶
Bases:
ds_resource_plugin_py_lib.common.resource.dataset.TabularDataset[ds_provider_mock_py_lib.linked_service.mock.MockLinkedService,ds_provider_mock_py_lib.dataset.settings.MockDatasetSettings,ds_resource_plugin_py_lib.common.serde.serialize.PandasSerializer,ds_resource_plugin_py_lib.common.serde.deserialize.PandasDeserializer]Read-only tabular dataset that emits deterministic synthetic rows.
- linked_service: ds_provider_mock_py_lib.linked_service.mock.MockLinkedService¶
- serializer: ds_resource_plugin_py_lib.common.serde.serialize.PandasSerializer | None¶
- deserializer: ds_resource_plugin_py_lib.common.serde.deserialize.PandasDeserializer | None¶
- property supports_checkpoint: bool¶
Whether this dataset supports incremental loads via
self.checkpoint.- Returns:
Always
Truefor the mock provider.- Return type:
bool
- property type: ds_provider_mock_py_lib.enums.ResourceType¶
Get the type of the dataset.
- Returns:
ResourceType
- read() None[source]¶
Read the current mock batch into
self.output.An empty checkpoint performs a full load (batch 0). A populated incremental watermark reads the next change batch. A pagination cursor resumes an in-flight batch after failure.
- Raises:
ReadError – If the mock backend fails or settings are invalid for read.
ConnectionError – If dataset-level injection is configured as a connection error.
- class ds_provider_mock_py_lib.dataset.MockColumn[source]¶
Bases:
ds_common_serde_py_lib.SerializableOne synthetic column in a mock dataset.
- name: str¶
Column name emitted in
self.output.
- kind: ds_provider_mock_py_lib.enums.ColumnKind¶
Value generator used for this column.
- value: Any = None¶
Payload for
constantandenum.A scalar is emitted on every row when
kindisconstant. A non-empty list is sampled whenkindisenum.
- prefix: str = ''¶
Prefix used when
kindistext.
- low: int = 0¶
Inclusive lower bound for random numeric kinds.
- high: int = 1000¶
Exclusive upper bound for random numeric kinds.
- null_every: int | None = None¶
When set, every Nth id is
None(stable across batches).
- class ds_provider_mock_py_lib.dataset.MockDatasetSettings[source]¶
Bases:
ds_resource_plugin_py_lib.common.resource.dataset.DatasetSettingsSettings that define mock read scope and injected failure behaviour.
- columns: list[MockColumn]¶
Synthetic columns included in every emitted row.
- row_count: int = 100¶
Rows in the full load (batch 0, all inserts).
- incremental_insert_count: int = 0¶
New unique primary keys delivered in each incremental batch.
- incremental_update_count: int = 0¶
Existing primary keys re-delivered with changed column values (row hash changes).
- incremental_noop_count: int = 0¶
Existing primary keys re-delivered with an identical row (same hash).
- page_size: int | None = None¶
Page size.
Noneemits the whole batch in one page.
- seed: int = 42¶
Determinism seed for id selection and random cell values.
- page_delay_ms: int = 0¶
Artificial delay applied after each successful page.
- op_column: str | None = None¶
Optional label column for intended row kind.
Gold merge uses primary key plus row hash, not this column. Leave unset so the label cannot change the hash of a noop row. Counts are always in
operation.metadata["ops"].
- modified_at_column: str = '_modified_at'¶
Column that stores the deterministic modified-at timestamp.
- raise_on_page: int | None = None¶
1-based page number within the current batch that should fail.
Nonedisables.
- raise_as: ds_provider_mock_py_lib.enums.RaiseAs¶
Contract exception class used when
raise_on_pagematches.
- raise_error: ds_provider_mock_py_lib.models.MockError¶
Error spec used when
raise_on_pagematches.