Connectors / APIs & web

GraphQL

source

GraphQL API source with cursor pagination

Install

cargo install faucet-cli --features source-graphql
faucet init --source graphql
# Cargo.toml — use it as a library
cargo add faucet-source-graphql

Starter config

source:
  type: graphql
  config:
    endpoint: ""    # REQUIRED — GraphQL endpoint URL.
    query: ""    # REQUIRED — The GraphQL query string.
    # variables: {}    # Variables to pass with the query.
    auth:
      type: none    # one of: none, bearer, custom
      # --- Alternative variants — replace the block above with one of these ---
      # type: bearer
      # config:
        # token: ""    # REQUIRED
      #
      # type: custom
      # config:
        # headers: {}    # REQUIRED
    # records_path: ""    # JSONPath expression to extract records from the response.
    # pagination: null    # Pagination configuration.
    # max_pages: 0    # Maximum number of pages to fetch.
    # batch_size: 1000    # Records per emitted `StreamPage`, and the value injected as the GraphQL `first:` cursor argument (or whatever variable name `GraphqlPagination::page_size_variable` specifies).
    # tls: null    # Optional client-certificate (mutual TLS) config.
    # replication_method: { type: FullTable }    # one of: FullTable, Incremental
      # --- Alternative variants — replace the block above with one of these ---
      # type: Incremental
    # replication_key: ""    # Field used for incremental replication bookmarking: a top-level field (`updatedAt`), a dot path into nested objects (`node.updatedAt`), or a JSON Pointer (`/node/updatedAt`).
    # on_missing_key: null    # What to do with a record whose replication key is missing or `null` (#747).
    # start_replication_value: null    # Initial bookmark used when no stored bookmark exists: records whose `replication_key` is not greater than it are filtere…
    # state_key: ""    # Identifier the pipeline persists this stream's bookmark under.
    # replication_bind: null    # Bind the bookmark into a GraphQL variable (see `GraphqlReplicationBind`).
    # replication_key_ordered: false    # Declares that the query returns records in ascending `replication_key` order.
    # retry_on_response: []    # Responses to treat as throttling and retry — including a `200` whose body reports it (`match_success: true` with `body_path: "$.errors[*].extensions.code"`, `values: [THROTTLED]`).
    # timeout: 30    # Per-request timeout in seconds.
    # connect_timeout: 10    # Timeout for establishing a connection, in seconds.

Capabilities

Replay Non-deterministic replay
Exactly-once replay No
Incremental Yes
Dataset discovery No
Reports lag No
Compression No

Config fields

FieldTypeDefaultDescription
endpoint
required
string — GraphQL endpoint URL.
query
required
string — The GraphQL query string.
auth
required
object — Authentication: either inline ({ type, config }) or a { ref: <name> } pointer to a shared provider in the CLI's top-level auth: catalog.
variables any {} Variables to pass with the query. Defaults to an empty object.
records_path string — JSONPath expression to extract records from the response.
pagination object — Pagination configuration. None for single-page queries. Accepts either the Relay cursor block (no type:) or an offset block (type: Offset) — see GraphqlPaginationSpec.
max_pages integer — Maximum number of pages to fetch.
batch_size integer 1000 Records per emitted StreamPage, and the value injected as the GraphQL first: cursor argument (or whatever variable name GraphqlPagination::page_size_variable specifies). Defaults to DEFAULT_BATCH_SIZE.
tls object — Optional client-certificate (mutual TLS) config. When set, the source presents a client certificate on every request (data + inline auth token request). Requires the crate's mtls feature.
replication_method object type: FullTable full_table (default) re-reads everything each run; incremental filters on replication_key and emits a bookmark on the final page so the next run resumes (#751).
replication_key string — Field used for incremental replication bookmarking: a top-level field (updatedAt), a dot path into nested objects (node.updatedAt), or a JSON Pointer (/node/updatedAt). Must resolve to one value per record.
on_missing_key object keep What to do with a record whose replication_key is missing or null once a start bookmark exists: keep (default), drop, or fail.
start_replication_value any — Initial bookmark used when no stored bookmark exists: records whose replication_key is not greater than it are filtered out, and a replication_bind renders it into the request.
state_key string — Identifier the pipeline persists this stream's bookmark under. Derived from the endpoint when unset and replicating incrementally.
replication_bind object — Bind the bookmark into a GraphQL variable (see GraphqlReplicationBind). Requires replication_method: incremental + replication_key.
replication_key_ordered boolean — Declares that the query returns records in ascending replication_key order. An incremental run that stops before the last page (max_pages, or a cursor loop) can resume past the pages it read only with this set and a replication_bind pushing the bookmark to the server; otherwise the run fails, since the bookmark could not advance. With max_pages, validate refuses this flag without a replication_bind.
retry_on_response array — Responses to treat as throttling and retry — including a 200 whose body reports it (match_success: true with body_path: "$.errors[*].extensions.code", values: [THROTTLED]). A rule's backoff_from reads the wait from the response (cost_bucket for a leaky-bucket cost report, or a reset header / body value). Checked before the response's errors[] are classified; a match retries the whole request, so partial data is never emitted.
timeout integer 30 Per-request timeout in seconds. Covers one HTTP request (a stalled peer fails the request, so retries and resilience can act), not the whole run. null disables it. Defaults to 30.
connect_timeout integer 10 Timeout for establishing a connection, in seconds. null disables it. Defaults to 10.
Get started

Your first pipeline runs in five minutes.

Install the CLI, scaffold a config, and move real data — nothing external to stand up.

curl -LsSf https://github.com/faucet-hq/faucet-stream/releases/latest/download/faucet-cli-installer.sh | sh
brew install faucet-hq/faucet-stream/faucet-cli