ComfyUI Node

DB Load Data

Feed a CSV, JSON, or YAML file straight into your graph

By hanoixan·Created 2 years ago·Updated 2 years ago· 2
DB Load Data
    • data
    path
    filter
    exclusive

    DB Load Data is the front door of the DataBeast pack, and it exists to solve the thing ComfyUI core is oddly bad at: reading a data file and letting it drive a workflow. You want to render a hundred prompts from a spreadsheet, or sweep a CFG grid from a config file, and stock ComfyUI gives you hardcoded text widgets and manual batch counts. Point this node at a .csv, .json, or .yml file and it loads the whole thing as a single DB_ITEM, which the rest of the pack - DBGetItem, DBGetBatchList, the DBConvert* casters - then picks apart.

    How it works

    The node reads the file, decides the parser by extension (.csv and .json get their own parsers, anything else falls back to YAML), and wraps the result in a DBItem. CSV files are turned into a dictionary with a single items key holding the rows as a list - that's why the README tells you to use ['items'] as your batch key. Two things happen after parsing that are easy to miss: the whole document gets scanned for ${['key']} style self-references and db_exec blocks, so a file can compute values that reference other values in the same file. The loader also returns float("NaN") from IS_CHANGED, which forces ComfyUI to re-read the file on every run instead of caching it - handy when you're editing the data between batches.

    The inputs that matter

    Only three, and for the basic case you only care about one:

    • path - the file to load. It's a plain text string, not a file browser, so give it an absolute path (e.g. C:/Users/you/prompts.yml or /home/you/data/items.csv).
    • filter - an optional regex applied line-by-line before parsing. Empty means "everything passes."
    • exclusive - whether the filter excludes matching lines (true) or only keeps them (false).

    The filter is genuinely useful for embedding data inside another file. The README's trick: prefix your data lines with something like mydata:, then set filter to [ \t]*mydata:(.*) and non-exclusive - only those lines survive, capture group and all, and the rest of the file is ignored.

    The output is a single data (DB_ITEM) that wires straight into DBGetItem and DBGetBatchList.

    Installing it

    Here's the gotcha that trips everyone up: this pack is not in ComfyUI Manager yet. The README says it will land there once stable, so searching Manager finds nothing. Install by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/hanoixan/ComfyUI-DataBeast
    cd ComfyUI-DataBeast
    pip install -r requirements.txt
    

    Then restart ComfyUI. The requirements are light - just pyyaml and RestrictedPython - and there are no model downloads, so nothing about this node will fill your disk.

    Common issues

    • No example workflows exist. The README still has a "TODO: show how a .yml file is read into a workflow" placeholder, and the one person who asked on r/comfyui for a working example was told "probably nowhere." The YAML examples in the README are your best teacher; expect to wire it up yourself.
    • Failures are silent. The loader swallows exceptions, so a bad path or malformed YAML gives you an empty dictionary and downstream nodes quietly produce nothing. Double-check your path and lint the file before you blame the node.
    • The API changed between V0.1 and V0.2 - DBGet* nodes now return DBItem, and the DBConvert* nodes expect one. Workflows you saved against an early alpha can break on update.

    One safety note, because it matters: expressions in this pack run through Python's eval(), sandboxed with RestrictedPython so only the passed-in values and basic indexing are reachable. That blocks code execution, but the author is upfront that a pathological expression can still burn CPU. Fine for your own trusted files; don't point it at data you don't control.

    CategoryDataBeast

    Inputs (3)

    NameTypeDefaultDescription
    pathSTRINGPath to file to load. .json and .csv are treated as their formats, anything else is interepreted as YAML.
    filterSTRINGPattern filter. If exclusive is true, only include lines that DO NOT match this regex filter. If not exclusive, include ONLY lines that match this filter. If using capture groups and not exclusive, all capture groups will be concatenated into the final text for that line.
    exclusiveBOOLEANExclude with pattern. If false, include only lines with the filter regex pattern, if there is one.

    Outputs (1)

    NameTypeDescription
    dataDB_ITEM