ComfyUI Node

Set Data

Wrap any single value in a dict, on demand

By chaserhkj·Created about a year ago·Updated 12 months ago· 0
Set Data
  • data
  • PYDICT
key

Set Data is the smallest idea in this pack: shove whatever value you've got under a key, and hand back a one-entry dict. {key: data} is the entire implementation. Tiny, but it's the glue that lets a bare string, number, or even a seed plug into any node that expects a PYDICT.

The two inputs are data (the wildcard type, meaning it accepts essentially anything - a string, an int, a float, an image, another dict) and key, a plain text field where you type the name the value should live under. The output is a PYDICT with exactly that one key. Want two values in the dict? Use two Set Data nodes and merge them, or start from YAML Data.

Why you'd bother. This pack's template nodes work off dicts: Prompt Template renders a Jinja template with a data dict as context, so [subject] in the template pulls data["subject"]. If you only have one value you care about - a filename, a character name, a CFG value you computed elsewhere - Set Data is the fastest way to give the template something to render against without building a whole YAML block. It's also handy when a node elsewhere in the graph hands you a value and the consumer stubbornly insists on a dict.

How it fits the pack. Set Data is part of Chaser's Custom Nodes, a small personal collection from chaserhkj. The README is upfront that these are ad-hoc nodes for his own workflows - "use them at your own risk, you have been warned." For a node this trivial, "risk" mostly means "no support if something breaks."

Install via ComfyUI Manager (search "Chaser's Custom Nodes") or:

cd ComfyUI/custom_nodes
git clone https://github.com/chaserhkj/ComfyUI-Chaser-nodes

then restart. No models involved; the pack's only real dependencies (jinja2, pyyaml, requests, sexpdata, av) install automatically.

Gotchas worth knowing:

  • The key input is a literal string you type - there's no dropdown. Misspell it once and the consumer gets a missing-key error or renders an empty string, and nothing tells you.
  • Because data is the wildcard type, the node happily accepts an image or a latent too. That's legal - the dict doesn't care what it holds. Just remember the template system renders values as text, so non-string values get stringified.
  • It's in-memory and stateless, like everything in this group. The dict exists for the duration of the run; there's no persistence, so don't expect values to survive a restart.

For combining several values into one dict, reach for Merge Data instead of stacking Set Data nodes - you'll thank yourself when the graph gets busy.

CategoryChaser Custom Nodes

Inputs (2)

NameTypeDefaultDescription
data*
keySTRING

Outputs (1)

NameTypeDescription
PYDICTPYDICT