ds_provider_xledger_py_lib.serde

File: __init__.py Region: ds_provider_xledger_py_lib/serde

Description

Serde helpers for the Xledger provider.

Submodules

Classes

XledgerDeserializer

Parse GraphQL responses into dataframes using operation metadata.

XledgerSerializer

Build GraphQL payloads from dataframe input and loaded metadata.

Package Contents

class ds_provider_xledger_py_lib.serde.XledgerDeserializer[source]

Bases: ds_resource_plugin_py_lib.common.serde.deserialize.base.DataDeserializer

Parse GraphQL responses into dataframes using operation metadata.

__call__(value: Any, **kwargs: Any) pandas.DataFrame[source]

Deserialize a GraphQL response body.

Parameters:
  • value – GraphQL response body.

  • **kwargs – Compatibility kwargs. Requires metadata and operation_settings.

Returns:

Parsed dataframe output.

get_next(value: Any, **kwargs: Any) bool[source]

Return hasNextPage from a read response payload.

Parameters:
  • value – GraphQL response body.

  • **kwargs – Compatibility kwargs. Requires metadata.

Returns:

True when there is a next page.

get_end_cursor(value: Any, **kwargs: Any) str | None[source]

Return last edge cursor from a read response payload.

Parameters:
  • value – GraphQL response body.

  • **kwargs – Compatibility kwargs. Requires metadata.

Returns:

Last cursor when available, otherwise None.

get_incremental_watermark(value: Any, *, metadata: ds_provider_xledger_py_lib.utils.introspection.MetaData) Any[source]

Return the highest incremental field value from a read response.

Uses metadata.incremental for the node field name and strategy (kind). When read metadata has no incremental section, returns None without inspecting the payload.

Parameters:
  • value – GraphQL response body.

  • metadata – Read operation metadata.

Returns:

The highest field value found in the current page, or None when incremental is not configured or the page has no comparable values.

Raises:
class ds_provider_xledger_py_lib.serde.XledgerSerializer[source]

Bases: ds_resource_plugin_py_lib.common.serde.serialize.base.DataSerializer

Build GraphQL payloads from dataframe input and loaded metadata.

__call__(obj: Any, **kwargs: Any) dict[str, Any][source]

Serialize dataframe into GraphQL payload.

Parameters:
  • obj – Input dataframe.

  • **kwargs – Compatibility kwargs. Requires operation and metadata and operation_settings.

Returns:

Payload in the form {"query": query, "variables": variables}.