ds_provider_mock_py_lib.dataset.mock ==================================== .. py:module:: ds_provider_mock_py_lib.dataset.mock .. autoapi-nested-parse:: **File:** ``mock.py`` **Region:** ``ds_provider_mock_py_lib/dataset`` Mock read-only dataset for e2e testing with deterministic change batches. The mock plays the role of a bronze-layer source. A full load emits the initial snapshot; every incremental load emits one change batch whose row-level composition is fully controlled by settings. Gold merge uses primary key plus row hash: insert is a new key, update is an existing key with changed values, and noop is an identical re-delivery. Follows ``DATASET_CONTRACT.md``. Field classification: exposed : id, name, description, version, settings, linked_service, serializer, deserializer internal : input, output, operation, checkpoint (base-class runtime fields) .. rubric:: 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() >>> len(dataset.output.index) 5 Attributes ---------- .. autoapisummary:: ds_provider_mock_py_lib.dataset.mock.logger Classes ------- .. autoapisummary:: ds_provider_mock_py_lib.dataset.mock.MockDataset Module Contents --------------- .. py:data:: logger .. py:class:: MockDataset Bases: :py:obj:`ds_resource_plugin_py_lib.common.resource.dataset.TabularDataset`\ [\ :py:obj:`ds_provider_mock_py_lib.linked_service.mock.MockLinkedService`\ , :py:obj:`ds_provider_mock_py_lib.dataset.settings.MockDatasetSettings`\ , :py:obj:`ds_resource_plugin_py_lib.common.serde.serialize.PandasSerializer`\ , :py:obj:`ds_resource_plugin_py_lib.common.serde.deserialize.PandasDeserializer`\ ] Read-only tabular dataset that emits deterministic synthetic rows. .. py:attribute:: linked_service :type: ds_provider_mock_py_lib.linked_service.mock.MockLinkedService .. py:attribute:: settings :type: ds_provider_mock_py_lib.dataset.settings.MockDatasetSettings .. py:attribute:: serializer :type: ds_resource_plugin_py_lib.common.serde.serialize.PandasSerializer | None .. py:attribute:: deserializer :type: ds_resource_plugin_py_lib.common.serde.deserialize.PandasDeserializer | None .. py:method:: __post_init__() -> None Ensure serializer and deserializer are always available. .. py:property:: supports_checkpoint :type: bool Whether this dataset supports incremental loads via ``self.checkpoint``. :returns: Always ``True`` for the mock provider. :rtype: bool .. py:property:: type :type: ds_provider_mock_py_lib.enums.ResourceType Get the type of the dataset. :returns: ResourceType .. py:method:: read() -> None 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. :raises ConnectionError: If dataset-level injection is configured as a connection error. .. py:method:: create() -> NoReturn Create is not supported by this dataset. .. py:method:: update() -> NoReturn Update is not supported by this dataset. .. py:method:: upsert() -> NoReturn Upsert is not supported by this dataset. .. py:method:: delete() -> NoReturn Delete is not supported by this dataset. .. py:method:: purge() -> NoReturn Purge is not supported by this dataset. .. py:method:: rename() -> NoReturn Rename is not supported by this dataset. .. py:method:: list() -> NoReturn List is not supported by this dataset. .. py:method:: close() -> None Close the dataset and underlying linked service. .. py:method:: _unsupported(method: str) -> NoReturn Raise ``NotSupportedError`` for a read-only method. :param method: Dataset method name. :raises NotSupportedError: Always.