singer_sdk.GraphQLStream

class singer_sdk.GraphQLStream[source]

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, next_page_token)[source]

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 (Context | None) – Stream partition or context dictionary.

  • next_page_token (_TToken | None) – 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.

Return type:

dict | None

property query: str[source]

Set or return the GraphQL query string.

Raises:

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

property records_jsonpath: str[source]

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

Returns:

JSONPath expression string

rest_method = 'POST'[source]

HTTP method to use for requests. Defaults to “GET”.