singer_sdk.GraphQLStream#

class singer_sdk.GraphQLStream#

Abstract base class for API-type streams.

GraphQL streams inherit from the class GraphQLStream, which in turn inherits from the RESTStream class. GraphQL streams are very similar to REST API-based streams, but instead of specifying a path and url_params, developers override the GraphQL query text.

prepare_request_payload(context: dict | None, next_page_token: t.Any | None) dict | None#

Prepare the data payload for the GraphQL API request.

Developers generally should generally not need to override this method. Instead, developers set the payload by properly configuring the query attribute.

Parameters:
  • context – Stream partition or context dictionary.

  • next_page_token – Token, page number or any request argument to request the next page of data.

Returns:

Dictionary with the body to use for the request.

Raises:

ValueError – If the query property is not set in the request body.

property query: str#

Set or return the GraphQL query string.

Raises:

NotImplementedError – If the derived class doesn’t define this property.

property records_jsonpath: str#

Get the JSONPath expression to extract records from an API response.

Returns:

JSONPath expression string