singer_sdk.GraphQLStream

class singer_sdk.GraphQLStream(tap: singer_sdk.plugin_base.PluginBase, name: Optional[str] = None, schema: Optional[Union[Dict[str, Any], singer.schema.Schema]] = None, path: Optional[str] = None)

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.

parse_response(response: requests.models.Response)Iterable[dict]

Parse the response and return an iterator of result rows.

Parameters

response – A raw requests.Response object.

Yields

One item for every item found in the response.

prepare_request_payload(context: Optional[dict], next_page_token: Optional[Any])Optional[dict]

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

Set or return the GraphQL query string.

Raises

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