ds_provider_aic_py_lib.dataset.gold

File: gold.py Region: ds_provider_aic_py_lib/dataset/gold

Read-only dataset for an AIC gold table served by the fetch API.

The settings hold the published definition from ds-pipeline-infra. This package does not own gold and does not write it.

read() requires SQL and posts it to POST /query/. Truncated pages are followed inside that call. A resumed read assigns output from the saved offset only.

Attributes

logger

_FETCH_URL

AICGoldDatasetSettingsType

AICIdentityLinkedServiceType

Classes

GoldReadSettings

SQL sent to fetch for read().

GoldListSettings

Scope for list() against GET /dataset/.

AICGoldDatasetSettings

Published gold definition and the fetch scope for this dataset.

AICGoldDataset

Read-only gold dataset. Mutation methods are not supported.

Module Contents

ds_provider_aic_py_lib.dataset.gold.logger
ds_provider_aic_py_lib.dataset.gold._FETCH_URL = 'https://grasp-daas.com/api/fetch/v1'
class ds_provider_aic_py_lib.dataset.gold.GoldReadSettings[source]

Bases: ds_common_serde_py_lib.Serializable

SQL sent to fetch for read().

sql: str

One statement for this dataset. Name it gold. Another dataset is rejected.

fresh: bool = False

Send Cache-Control: no-cache when true.

class ds_provider_aic_py_lib.dataset.gold.GoldListSettings[source]

Bases: ds_common_serde_py_lib.Serializable

Scope for list() against GET /dataset/.

names: list[str] | None = None

Dataset names. None lists everything the caller is granted.

layers: list[ds_provider_aic_py_lib.enums.Layer] | None = None

Layers to include. None does not filter by layer.

limit: int = 100

Page size. Fetch accepts 1 to 500.

fresh: bool = False

Send Cache-Control: no-cache when true.

class ds_provider_aic_py_lib.dataset.gold.AICGoldDatasetSettings[source]

Bases: ds_resource_plugin_py_lib.common.resource.dataset.DatasetSettings

Published gold definition and the fetch scope for this dataset.

url: str = 'https://grasp-daas.com/api/fetch/v1'

Fetch API base URL.

publish_mode: ds_provider_aic_py_lib.enums.PublishMode

How candidate rows mutate published gold state. Stored, not executed.

primary_key_fields: AICGoldDatasetSettings.list[str]

Business key of the published dataset.

history_mode: ds_provider_aic_py_lib.enums.HistoryMode

History strategy of the published dataset.

partition_keys: AICGoldDatasetSettings.list[str]

Partition columns of the published dataset.

ordering_field: str | None = None

Duplicate-winner field of the published dataset.

delete_field: str | None = None

Delete-intent field of the published dataset.

read: GoldReadSettings | None = None

SQL for read(). Required when reading.

list: GoldListSettings

Scope for list().

ds_provider_aic_py_lib.dataset.gold.AICGoldDatasetSettingsType
ds_provider_aic_py_lib.dataset.gold.AICIdentityLinkedServiceType
class ds_provider_aic_py_lib.dataset.gold.AICGoldDataset[source]

Bases: ds_resource_plugin_py_lib.common.resource.dataset.TabularDataset[AICIdentityLinkedServiceType, AICGoldDatasetSettingsType, ds_resource_plugin_py_lib.common.serde.serialize.PandasSerializer, ds_provider_aic_py_lib.serde.deserializer.FetchQueryDeserializer], Generic[AICIdentityLinkedServiceType, AICGoldDatasetSettingsType]

Read-only gold dataset. Mutation methods are not supported.

linked_service: AICIdentityLinkedServiceType
settings: AICGoldDatasetSettingsType
serializer: ds_resource_plugin_py_lib.common.serde.serialize.PandasSerializer | None = None

Unused. Gold is read-only.

deserializer: ds_provider_aic_py_lib.serde.deserializer.FetchQueryDeserializer

Materializes one fetch query page.

property type: ds_provider_aic_py_lib.enums.ResourceType

Resource type discriminator.

property supports_checkpoint: bool

A failed read keeps the next offset in checkpoint['pagination'].

read() → None[source]

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.

list() → None[source]

List granted datasets and assign one frame to output.

Raises:

ListError – Fetch rejects a page or a page is not a dataset page.

create() → None[source]

Gold is owned by the platform.

update() → None[source]

Gold is owned by the platform.

upsert() → None[source]

Gold is owned by the platform.

delete() → None[source]

Gold is owned by the platform.

purge() → None[source]

Gold is owned by the platform.

rename() → None[source]

Gold is owned by the platform.

close() → None[source]

Release the identity session.

_query(sql: str) → dict[str, Any][source]
_headers(fresh: bool) → dict[str, str][source]