Nodes/comfyui-tensorop/FetchJsonFromSurreal
ComfyUI Node

FetchJsonFromSurreal

The node that reads your SurrealDB — if you even run SurrealDB

By un-seen·Created 2 years ago·Updated 2 years ago· 46
FetchJsonFromSurreal
    • JSON
    database
    id
    key

    FetchJsonFromSurreal is the read half of the pack's database story: you give it a database, a record id, and a field name, and it returns that field as JSON. It's the counterpart to the same pack's SaveJsonToSurreal and SaveTextToSurreal. If that sentence made you want to search for what SurrealDB is, this node probably isn't for you - and that's fine. It's plumbing from a real pipeline, not a node the average ComfyUI user reaches for.

    For context: this is the node you'd use when your workflow's state or results live in a SurrealDB database that something else - a backend, a queue worker, another service - is writing to. You query it mid-graph, get JSON out, and keep going. There's no local SurrealDB bundled, no model, nothing to download. It just talks to a server you already have running.

    How it works

    The mechanism is short and revealing. The node connects with the surrealist client over HTTP (10-second timeout), then runs a query it builds itself:

    SELECT {key} from processor:`{id}`
    

    and returns the first row's key field. Two things jump out. The table is hardcoded to processor - you can't pick a table, so your records have to live in one named exactly that. And both key and id are interpolated straight into the query string. That's fine for your own carefully-typed inputs and a real footgun if you ever feed it anything dynamic or untrusted - special characters in the id will break the query, and you're effectively handing it raw query fragments.

    Inputs and outputs

    Three required strings, all typed by hand:

    • database - which SurrealDB database to connect to (credentials and namespace come from config, see below).
    • id - the record id, used directly in the query.
    • key - the field name to extract.

    Output: JSON - the value of that field, ready to wire into any JSON-consuming node.

    Installing it

    Via ComfyUI Manager, search the pack title comfyui-tensorop, or by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/un-seen/comfyui-tensorops
    cd comfyui-tensorops
    pip install -r requirements.txt
    

    Then restart ComfyUI. The one dependency this node actually needs is surrealist, but the pack's requirements.txt installs the full stack - transformers, boto3, fal-client, replicate - whether you want them or not. Note the repo's README is empty, so the source code is your only documentation.

    Where people get burned

    • Empty config. nodes/config.py ships with SURREAL_URL, SURREAL_NAMESPACE, SURREAL_USER, and SURREAL_PASSWORD all blank. Fill them in or the connection fails instantly.
    • The hardcoded table. Records must sit in a table literally called processor. If your data lives elsewhere, this node can't see it.
    • Manager conflict warnings. The pack shares node names with Kijai's ComfyUI-Florence2, so ComfyUI Manager may warn about a clash when you install it - even if you only want the database nodes. Worth knowing before you blame the install.

    Honest verdict: if you already run SurrealDB as part of a pipeline, this is a neat, tiny read node. If you don't, skip it - it's not a reason to stand up a database.

    Categorydatabase_ops

    Inputs (3)

    NameTypeDefaultDescription
    databaseSTRING
    idSTRING
    keySTRING

    Outputs (1)

    NameTypeDescription
    JSONJSON