ds_provider_powerofficego_py_lib.dataset¶
File: __init__.py
Region: ds_provider_powerofficego_py_lib/dataset
This module contains dataset-related classes and functions for the PowerOfficeGo provider.
Submodules¶
Classes¶
PowerOfficeGoDataset represents a dataset for the PowerOfficeGo provider. |
|
Settings for PowerOfficeGo dataset. |
|
Settings for reading from PowerOfficeGo dataset. |
Package Contents¶
- class ds_provider_powerofficego_py_lib.dataset.PowerOfficeGoDataset[source]¶
Bases:
ds_resource_plugin_py_lib.common.resource.dataset.TabularDataset[PowerOfficeGoLinkedServiceType,PowerOfficeGoDatasetSettingsType,ds_resource_plugin_py_lib.common.serde.serialize.PandasSerializer,ds_resource_plugin_py_lib.common.serde.deserialize.PandasDeserializer],Generic[PowerOfficeGoLinkedServiceType,PowerOfficeGoDatasetSettingsType]PowerOfficeGoDataset represents a dataset for the PowerOfficeGo provider.
- linked_service¶
The linked service used to connect to PowerOfficeGo.
- settings¶
The settings for the dataset, including data product and read settings.
- serializer¶
The serializer used for the dataset. Defaults to JSON format.
- Type:
PandasSerializer | None
- deserializer¶
The deserializer used for the dataset. Defaults to JSON format.
- Type:
PandasDeserializer | None
- linked_service: PowerOfficeGoLinkedServiceType¶
- settings: PowerOfficeGoDatasetSettingsType¶
- serializer: ds_resource_plugin_py_lib.common.serde.serialize.PandasSerializer | None¶
- deserializer: ds_resource_plugin_py_lib.common.serde.deserialize.PandasDeserializer | None¶
- property type: ds_provider_powerofficego_py_lib.enums.ResourceType¶
Get the type of the dataset.
- property supports_checkpoint: bool¶
Whether this provider supports incremental loads via
self.checkpoint.The checkpoint is a dictionary that tracks pagination and incremental state:
On a full load,
self.checkpointis expected to be empty ({}) orNone. In this case,read()starts from page1.After each successfully read page,
self.checkpointis updated with at least{"last_page": page, ...}.If incremental loading is possible (i.e., the data contains a
lastChangedDateTimeOffsetfield), the checkpoint will also include anincrementalkey with the latest observed value:{"incremental": {"last_modified_date": ...}}.On a subsequent run, if
self.checkpointcontains a"last_page"entry,read()resumes fromlast_page + 1and continues fetching data from the PowerOfficeGo API.If
self.checkpointcontains anincrementalkey, the loader will use the storedlast_modified_dateto filter for new/changed records.
This allows consumers to perform incremental loads by persisting and reusing the checkpoint between executions, avoiding re-reading pages that were already processed successfully. The checkpoint structure is designed to support both paginated and incremental (watermark-based) loading.
- Returns:
True if checkpointing is supported, False otherwise.
- Return type:
bool
- read() None[source]¶
Read data from PowerOfficeGo API from requested endpoint.
- Raises:
ReadError – If there is an error during the read operation.
- create() None[source]¶
Insert all rows in
self.inputinto the target as a single atomic transaction. Must not delete, update, or overwrite existing data.- Raises:
CreateError – If the operation fails.
NotSupportedError – If the provider does not support create.
See also
Full contract:
docs/DATASET_CONTRACT.md–create()
- delete() None[source]¶
Remove specific rows from the target matched by identity columns defined in
self.settings. Atomic. Idempotent.- Raises:
DeleteError – If the operation fails.
NotSupportedError – If the provider does not support delete.
See also
Full contract:
docs/DATASET_CONTRACT.md–delete()
- update() None[source]¶
Update existing rows in the target matched by identity columns defined in
self.settings. Atomic. Must not insert new rows.- Raises:
UpdateError – If the operation fails.
NotSupportedError – If the provider does not support update.
See also
Full contract:
docs/DATASET_CONTRACT.md–update()
- rename() None[source]¶
Rename the resource in the backend. Atomic. Not idempotent.
- Raises:
RenameError – If the operation fails.
NotSupportedError – If the provider does not support renaming.
See also
Full contract:
docs/DATASET_CONTRACT.md–rename()
- list() None[source]¶
Discover available resources and populate
self.outputwith a DataFrame of resources and their metadata. Idempotent.- Raises:
ListError – If the operation fails.
NotSupportedError – If the provider does not support listing.
See also
Full contract:
docs/DATASET_CONTRACT.md–list()
- upsert() None[source]¶
Insert rows that do not exist, update rows that do, matched by identity columns defined in
self.settings. Atomic.- Raises:
UpsertError – If the operation fails.
NotSupportedError – If the provider does not support upsert.
See also
Full contract:
docs/DATASET_CONTRACT.md–upsert()
- purge() None[source]¶
Remove all content from the target.
self.inputis not used. Atomic. Idempotent.- Raises:
PurgeError – If the operation fails.
NotSupportedError – If the provider does not support purge.
See also
Full contract:
docs/DATASET_CONTRACT.md–purge()
- _resume_point() tuple[str | None, int][source]¶
Derive the incremental watermark and starting page from
self.checkpoint.- Returns:
(last_modified_date, page). A full load returns(None, 1).- Return type:
tuple[str | None, int]
- _fetch_data(session: Any) None[source]¶
Fetch data from PowerOfficeGo API using the provided session.
Product modules may take over for specialized reads (e.g. TrialBalance history via
filters.date_from). Other products keep the single paginated read.- Parameters:
session (Any) – The session object to use for making API requests.
- Raises:
ReadError – If there is an error during the data fetching process.
- class ds_provider_powerofficego_py_lib.dataset.PowerOfficeGoDatasetSettings[source]¶
Bases:
ds_resource_plugin_py_lib.common.resource.dataset.DatasetSettingsSettings for PowerOfficeGo dataset.
- data_product¶
Data product to read from PowerOfficeGo API. Required. Must match product name as used in DS Config.
- Type:
str
- read¶
Settings for reading from PowerOfficeGo dataset. Contains pagination and filtering options.
- Type:
- data_product: str¶
Data product to read from PowerOfficeGo API. Required. Must match product name as used in DS Config.
- read: ReadSettings¶
Settings for reading from PowerOfficeGo dataset.
- class ds_provider_powerofficego_py_lib.dataset.ReadSettings[source]¶
Bases:
ds_common_serde_py_lib.SerializableSettings for reading from PowerOfficeGo dataset.
- page_size¶
Number of records to read per page. Default is 20,000.
- Type:
int
- fields¶
List of fields to include in the response. Optional.
- Type:
list[str] | None
- filters¶
Query filters for the API request. Optional. Product-specific keys (see
TrialBalanceFilter) are handled by product modules and are not forwarded as native query params.- Type:
dict[str, Any] | None
- page_size: int = 20000¶
Number of records to read per page. Default is 20,000.
- fields: list[str] | None = None¶
List of fields to include in the response. Optional.
- filters: dict[str, Any] | None = None¶
Filters for the API request / product-specific read window.
Native PowerOffice query params are passed through. TrialBalance history uses
TrialBalanceFilter.DATE_FROM(required) and optionalTrialBalanceFilter.DATE_TO(ISOYYYY-MM-DD; defaults to today).Example
>>> from ds_provider_powerofficego_py_lib.enums import TrialBalanceFilter >>> ReadSettings(filters={TrialBalanceFilter.DATE_FROM: "2025-01-01"}) >>> ReadSettings(filters={ ... TrialBalanceFilter.DATE_FROM: "2025-01-01", ... TrialBalanceFilter.DATE_TO: "2025-12-31", ... }) >>> ReadSettings(filters={"date": "2025-12-31"})