ds_provider_aic_py_lib.dataset ============================== .. py:module:: ds_provider_aic_py_lib.dataset .. autoapi-nested-parse:: **File:** ``__init__.py`` **Region:** ``ds_provider_aic_py_lib/dataset`` AIC gold dataset. .. rubric:: Example >>> dataset = AICGoldDataset( ... id=uuid.uuid4(), ... name="employees", ... version="1.0.0", ... linked_service=linked_service, ... settings=AICGoldDatasetSettings( ... publish_mode=PublishMode.UPSERT, ... primary_key_fields=["employee_id"], ... history_mode=HistoryMode.SCD2, ... partition_keys=[], ... read=GoldReadSettings(sql="SELECT * FROM gold"), ... ), ... ) >>> dataset.read() >>> dataset.output Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/ds_provider_aic_py_lib/dataset/gold/index /autoapi/ds_provider_aic_py_lib/dataset/utils/index Classes ------- .. autoapisummary:: ds_provider_aic_py_lib.dataset.AICGoldDataset ds_provider_aic_py_lib.dataset.AICGoldDatasetSettings ds_provider_aic_py_lib.dataset.GoldListSettings ds_provider_aic_py_lib.dataset.GoldReadSettings Package Contents ---------------- .. py:class:: AICGoldDataset Bases: :py:obj:`ds_resource_plugin_py_lib.common.resource.dataset.TabularDataset`\ [\ :py:obj:`AICIdentityLinkedServiceType`\ , :py:obj:`AICGoldDatasetSettingsType`\ , :py:obj:`ds_resource_plugin_py_lib.common.serde.serialize.PandasSerializer`\ , :py:obj:`ds_provider_aic_py_lib.serde.deserializer.FetchQueryDeserializer`\ ], :py:obj:`Generic`\ [\ :py:obj:`AICIdentityLinkedServiceType`\ , :py:obj:`AICGoldDatasetSettingsType`\ ] Read-only gold dataset. Mutation methods are not supported. .. py:attribute:: linked_service :type: AICIdentityLinkedServiceType .. py:attribute:: settings :type: AICGoldDatasetSettingsType .. py:attribute:: serializer :type: ds_resource_plugin_py_lib.common.serde.serialize.PandasSerializer | None :value: None Unused. Gold is read-only. .. py:attribute:: deserializer :type: ds_provider_aic_py_lib.serde.deserializer.FetchQueryDeserializer Materializes one fetch query page. .. py:property:: type :type: ds_provider_aic_py_lib.enums.ResourceType Resource type discriminator. .. py:property:: supports_checkpoint :type: bool A failed read keeps the next offset in ``checkpoint['pagination']``. .. py:method:: read() -> None Post the required SQL and assign this call's result to ``output``. Fetch stops a response at 100_000 rows or 8 MiB. This call follows truncated pages until the result is complete. On a resumed read, ``output`` holds only the pages from the saved offset; the caller keeps earlier pages. Pass ``checkpoint['pagination']['offset']`` to continue, or an empty checkpoint to read from the start. Keep the same SQL in settings. The offset is not stored with the statement. Later pages use ``OFFSET``. Fetch does not keep a stable row order unless the SQL has ``ORDER BY``, so those pages can skip or repeat rows. A read that continues without ``ORDER BY`` logs a warning and still returns the rows. A failure keeps the pages already read in this call in ``output`` and the next offset in ``checkpoint['pagination']``. A truncated page with no rows to continue from raises and leaves that offset in place. :raises ReadError: SQL is missing, a quoted reference names another dataset, fetch rejects a page, or a truncated page cannot be continued. .. py:method:: list() -> None List granted datasets and assign one frame to ``output``. :raises ListError: Fetch rejects a page or a page is not a dataset page. .. py:method:: create() -> None Gold is owned by the platform. .. py:method:: update() -> None Gold is owned by the platform. .. py:method:: upsert() -> None Gold is owned by the platform. .. py:method:: delete() -> None Gold is owned by the platform. .. py:method:: purge() -> None Gold is owned by the platform. .. py:method:: rename() -> None Gold is owned by the platform. .. py:method:: close() -> None Release the identity session. .. py:method:: _query(sql: str) -> dict[str, Any] .. py:method:: _headers(fresh: bool) -> dict[str, str] .. py:class:: AICGoldDatasetSettings Bases: :py:obj:`ds_resource_plugin_py_lib.common.resource.dataset.DatasetSettings` Published gold definition and the fetch scope for this dataset. .. py:attribute:: url :type: str :value: 'https://grasp-daas.com/api/fetch/v1' Fetch API base URL. .. py:attribute:: publish_mode :type: ds_provider_aic_py_lib.enums.PublishMode How candidate rows mutate published gold state. Stored, not executed. .. py:attribute:: primary_key_fields :type: AICGoldDatasetSettings.list[str] Business key of the published dataset. .. py:attribute:: history_mode :type: ds_provider_aic_py_lib.enums.HistoryMode History strategy of the published dataset. .. py:attribute:: partition_keys :type: AICGoldDatasetSettings.list[str] Partition columns of the published dataset. .. py:attribute:: ordering_field :type: str | None :value: None Duplicate-winner field of the published dataset. .. py:attribute:: delete_field :type: str | None :value: None Delete-intent field of the published dataset. .. py:attribute:: read :type: GoldReadSettings | None :value: None SQL for ``read()``. Required when reading. .. py:attribute:: list :type: GoldListSettings Scope for ``list()``. .. py:class:: GoldListSettings Bases: :py:obj:`ds_common_serde_py_lib.Serializable` Scope for ``list()`` against ``GET /dataset/``. .. py:attribute:: names :type: list[str] | None :value: None Dataset names. ``None`` lists everything the caller is granted. .. py:attribute:: layers :type: list[ds_provider_aic_py_lib.enums.Layer] | None :value: None Layers to include. ``None`` does not filter by layer. .. py:attribute:: limit :type: int :value: 100 Page size. Fetch accepts 1 to 500. .. py:attribute:: fresh :type: bool :value: False Send ``Cache-Control: no-cache`` when true. .. py:class:: GoldReadSettings Bases: :py:obj:`ds_common_serde_py_lib.Serializable` SQL sent to fetch for ``read()``. .. py:attribute:: sql :type: str One statement for this dataset. Name it ``gold``. Another dataset is rejected. .. py:attribute:: fresh :type: bool :value: False Send ``Cache-Control: no-cache`` when true.