ds_protocol_graphql_py_lib¶
File: __init__.py
Region: ds-protocol-graphql-py-lib
Description¶
A Python package from the ds-protocol-graphql-py-lib library.
Example
from ds_protocol_graphql_py_lib import __version__
print(f"Package version: {__version__}")
Submodules¶
Attributes¶
Classes¶
Deserializer for GraphQL API responses. |
|
Represent Graphql dataset. |
|
The object containing the settings of the dataset. |
Package Contents¶
- class ds_protocol_graphql_py_lib.GraphqlDeserializer[source]¶
Bases:
ds_resource_plugin_py_lib.common.serde.deserialize.PandasDeserializerDeserializer for GraphQL API responses.
Handles various GraphQL response patterns: - Direct arrays: {“data”: {“users”: […]}} - Relay connections: {“data”: {“users”: {“edges”: [{“node”: {…}}]}}} - Single objects: {“data”: {“user”: {…}}} - Introspection queries: {“data”: {“__type”: {“fields”: […]}}}
- deserialize_graphql(data: Any) pandas.DataFrame[source]¶
Deserialize GraphQL response to pandas DataFrame.
- Parameters:
data – GraphQL response dict or raw data
- Returns:
DataFrame containing the extracted data
- _parse_graphql_data(data: Any) pandas.DataFrame[source]¶
Parse GraphQL data structure into DataFrame.
Handles nested structures and various GraphQL response patterns.
- Parameters:
data – The data portion of the GraphQL response
- Returns:
DataFrame with the extracted data
- class ds_protocol_graphql_py_lib.GraphqlDataset[source]¶
Bases:
ds_resource_plugin_py_lib.common.resource.dataset.TabularDataset[ds_protocol_http_py_lib.dataset.http.HttpLinkedServiceType,GraphqlDatasetSettingsType,ds_resource_plugin_py_lib.common.serde.serialize.PandasSerializer,ds_protocol_graphql_py_lib.serde.deserializer.GraphqlDeserializer],Generic[ds_protocol_http_py_lib.dataset.http.HttpLinkedServiceType,GraphqlDatasetSettingsType]Represent Graphql dataset.
- settings: GraphqlDatasetSettingsType¶
- linked_service: ds_protocol_http_py_lib.dataset.http.HttpLinkedServiceType¶
- deserializer: ds_protocol_graphql_py_lib.serde.deserializer.GraphqlDeserializer | None¶
- property type: ds_protocol_graphql_py_lib.enums.ResourceType¶
Get the type of the dataset.
- property supports_checkpoint: bool¶
Indicate whether this provider supports incremental loads via checkpointing.
GraphQL provider does not yet support checkpoint-based incremental loads. All reads are full loads.
- Returns:
False, indicating checkpointing is not supported.
- read() None[source]¶
Read Graphql dataset.
Sends a GraphQL query to the endpoint with the query, variables, and operation name specified in settings.read. Populates self.output with the result as a DataFrame.
Handles various GraphQL response patterns via GraphqlDeserializer: - Direct arrays: {“data”: {“users”: […]}} - Relay connections: {“data”: {“users”: {“edges”: [{“node”: {…}}]}}} - Single objects: {“data”: {“user”: {…}}}
- Returns:
None. The result is stored in self.output as a DataFrame.
- Raises:
ConnectionError – If the linked service connection is not initialized.
ReadError – If read settings are not provided or if the GraphQL query fails.
- create() None[source]¶
Create new rows in the GraphQL endpoint using mutations.
Sends all rows in a single atomic GraphQL mutation request. Populates self.output with the created rows.
- Returns:
None. The result is stored in self.output as a DataFrame.
- Raises:
ConnectionError – If the linked service connection is not initialized.
CreateError – If create settings are not provided or if the GraphQL mutation fails.
- delete() None[source]¶
Delete specific rows from the GraphQL endpoint using mutations.
Sends all rows in a single atomic GraphQL mutation request. Populates self.output with the deleted rows.
- Returns:
None. The result is stored in self.output as a DataFrame.
- Raises:
ConnectionError – If the linked service connection is not initialized.
DeleteError – If delete settings are not provided, if identity columns are missing, or if the GraphQL mutation fails.
- list() None[source]¶
Discover available resources in the GraphQL schema via introspection.
Executes a GraphQL introspection query to fetch all available queries and their arguments from the schema. Populates self.output with a DataFrame containing resource metadata (name, type, description, etc.).
- Returns:
None. The result is stored in self.output as a DataFrame.
- Raises:
ConnectionError – If the linked service connection is not initialized.
ListError – If the GraphQL introspection query fails.
- class ds_protocol_graphql_py_lib.GraphqlDatasetSettings[source]¶
Bases:
ds_resource_plugin_py_lib.common.resource.dataset.DatasetSettingsThe object containing the settings of the dataset.
- url: str¶
The URL of the GraphQL endpoint to connect to. This is the base URL where the GraphQL API is hosted.
- primary_keys: list[str] | None = None¶
Optional list of column names that serve as primary keys for the dataset. This can be used for operations that require unique identification of rows.
- headers: dict[str, str] | None = None¶
Optional HTTP headers to include in requests to the GraphQL endpoint, such as authentication tokens or content type.
- read: GraphqlReadSettings | None = None¶
Settings for read operations.
- delete: GraphqlDeleteSettings | None = None¶
Settings for delete operations.
- create: GraphqlCreateSettings | None = None¶
Settings for create operations.
- ds_protocol_graphql_py_lib.__version__¶