ds_protocol_soap_py_lib.dataset

File: __init__.py Region: ds_protocol_soap_py_lib/dataset

SOAP Dataset

This module implements a dataset for SOAP APIs.

Example

>>> import uuid
>>> from ds_protocol_soap_py_lib.dataset.soap import SoapDataset, SoapDatasetSettings
>>> from ds_protocol_soap_py_lib.enums import AuthType
>>> from ds_protocol_soap_py_lib.linked_service.soap import (
...     ParameterBasedAuthSettings,
...     SoapLinkedService,
...     SoapLinkedServiceSettings,
... )
>>> linked_service = SoapLinkedService(
...     id=uuid.uuid4(),
...     name="example::linked_service",
...     version="1.0.0",
...     settings=SoapLinkedServiceSettings(
...         wsdl="https://example.com/service?wsdl",
...         auth_type=AuthType.PARAMETER_BASED,
...         auth_test_method="Ping",
...         parameter_based=ParameterBasedAuthSettings(
...             auth_param_key1="apiKey",
...             auth_param_value1="my-token",
...         ),
...     ),
... )
>>> dataset = SoapDataset(
...     id=uuid.uuid4(),
...     name="example::dataset",
...     version="1.0.0",
...     settings=SoapDatasetSettings(method="GetRecords"),
...     linked_service=linked_service,
... )
>>> dataset.read()
>>> data = dataset.output

Submodules

Classes

SoapDataset

Dataset for SOAP APIs.

SoapDatasetSettings

Settings for SOAP dataset.

Package Contents

class ds_protocol_soap_py_lib.dataset.SoapDataset[source]

Bases: ds_resource_plugin_py_lib.common.resource.dataset.TabularDataset[SoapLinkedServiceType, SoapDatasetSettingsType, ds_resource_plugin_py_lib.common.serde.serialize.PandasSerializer, ds_resource_plugin_py_lib.common.serde.deserialize.PandasDeserializer], Generic[SoapLinkedServiceType, SoapDatasetSettingsType]

Dataset for SOAP APIs.

Calls a configured SOAP method via the linked service connection. Authentication parameters from the linked service are automatically injected into each call.

read() fetches data from the SOAP endpoint and populates self.output. create() sends data to the SOAP endpoint. All other operations raise NotSupportedError.

linked_service: SoapLinkedServiceType
settings: SoapDatasetSettingsType
deserializer: ds_resource_plugin_py_lib.common.serde.deserialize.PandasDeserializer | None
property type: ds_protocol_soap_py_lib.enums.ResourceType

Get the type of the dataset.

_invoke_method(error_cls: type[ds_resource_plugin_py_lib.common.resource.dataset.errors.ReadError | ds_resource_plugin_py_lib.common.resource.dataset.errors.CreateError]) Any[source]

Call the configured SOAP method and return the serialized response.

Returns None if the SOAP response is empty.

Parameters:

error_cls – The error class to raise on failure (ReadError or CreateError).

Raises:

ReadError | CreateError – If the SOAP call fails.

read() None[source]

Call the configured SOAP method and populate self.output.

The zeep response is serialised to native Python types via zeep.helpers.serialize_object and normalised into a DataFrame.

Raises:

ReadError – If the SOAP call fails or no deserializer is configured.

create() None[source]

Call the configured SOAP method to create an entity.

Returns immediately if self.input is empty (no-op). Calls the SOAP method with auth params and settings.kwargs. Sets self.output to the deserialized backend response, or a copy of self.input if the response is empty or no deserializer is configured.

Raises:

CreateError – If the SOAP call fails.

update() NoReturn[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.mdupdate()

delete() NoReturn[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.mddelete()

upsert() NoReturn[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.mdupsert()

purge() NoReturn[source]

Remove all content from the target. self.input is 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.mdpurge()

list() NoReturn[source]

Discover available resources and populate self.output with 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.mdlist()

rename() NoReturn[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.mdrename()

close() None[source]

Close the linked service connection.

class ds_protocol_soap_py_lib.dataset.SoapDatasetSettings[source]

Bases: ds_resource_plugin_py_lib.common.resource.dataset.DatasetSettings

Settings for SOAP dataset.

method: str

The SOAP method to call.

kwargs: dict[str, Any]

Additional keyword arguments to pass to the SOAP method alongside the auth parameters from the linked service.