ComfyUI Node

Merge Data

The merge node that settles the override argument

By chaserhkj·Created about a year ago·Updated 11 months ago· 0
Merge Data
  • base_dict
  • override_dict
  • PYDICT

Once you start building workflows with dicts - from YAML Data, Set Data, or any of the template nodes in this pack - you'll want to layer them. Merge Data is the two-line function that does it: it takes a base dict, splats an override dict on top, and hands you the combined result.

It's about as simple as a node gets. The base PYDICT input is required; the override_dict is optional. Internally it copies the base and runs update() with the override, so any key that appears in both is won by the override. That's the whole mechanism - and it's the "defaults, then your specific bits" pattern you actually want in a workflow. Have one dict full of sensible prompt data or sampler settings, keep your per-run changes in a second dict, and merge them so the per-run values win without you hand-editing the whole structure.

The one real caveat is that it's a shallow merge. override_dict replaces top-level keys wholesale; if your dicts have nested structures, the nested parts of the base get clobbered rather than merged. If your data is flat key→value pairs (which is the common case here), you'll never notice.

Where it lives. This is one of a small family of dict/template utilities in Chaser's Custom Nodes, a personal pack by chaserhkj. The README says the nodes aren't "meant to be used out of any context that I am already using them in" and to use them at your own risk - so treat it as a well-worn personal tool, not a supported product.

Install is the same for every node in the pack - ComfyUI Manager (search "Chaser's Custom Nodes"), or:

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

then restart ComfyUI. No models to download; the only real dependencies are jinja2, pyyaml, requests, sexpdata, and av, which the Manager installs for you.

What you actually wire. Both inputs are forced-input PYDICTs, so you can't type one in by hand - they come from Set Data, YAML Data, YAML File Loader, or another Merge Data. The single PYDICT output feeds anything that consumes a dict, most usefully the data input on Prompt Template or the override_dict of a downstream merge. Chain two merges together and you've got a three-layer stack: base, defaults, run-time overrides.

The trap beginners hit: forgetting that override_dict is optional and leaving it empty. That's fine - you get a copy of the base, which is exactly what you'd want if the node is acting as a pass-through. The subtler trap is expecting a deep merge and watching nested defaults vanish. Flat data, no surprises; nested data, know what you're giving up.

CategoryChaser Custom Nodes

Inputs (2)

NameTypeDefaultDescription
base_dictPYDICT
override_dictoptPYDICT

Outputs (1)

NameTypeDescription
PYDICTPYDICT