Nodes/comfyui-snek-nodes/Snek SQLite Prompt Logger
ComfyUI Node

Snek SQLite Prompt Logger

A variation log you can actually query

By sneccc·Created 2 years ago·Updated 12 months ago· 1
Snek SQLite Prompt Logger
    • database_path
    • stats
    db_namevariation_prompts.db
    original_image_path
    variation_image_path
    variation_image_prompt

    If you run a lot of variation experiments, you've probably kept the notes in a text file that never gets queried. This node is the discipline version: every time it runs, it appends one row to a SQLite database recording the original image path, the variation image path, and the prompt that produced it. Later, you open the database with any SQLite tool and actually ask questions - "which original images produced the most variations?" - instead of scrolling.

    What it is. Snek SQLite Prompt Logger is a logging node from the comfyui-snek-nodes pack. It takes three strings and a database name, inserts a row into a table called variation_prompts, and returns both the path to the database and a small stats summary. It's designed for tracking the classic "take an image, generate variations, note what you asked for" loop - which pairs naturally with the pack's Aesthetics V2 ranker (keep the best variation) and Save_Image_And_Caption (get the paths to feed in as strings).

    How it works. Plain, dependency-free sqlite3. On each run it normalizes the db_name (strips whitespace, appends .db if missing, and refuses names containing path separators), resolves the database path to inside the pack's own install folder, creates the table if it doesn't exist, and inserts your three strings as a row. The stats output is a quick query result: total entries, distinct original images, distinct variation paths, and unique prompts. All four in one text blob, formatted as plain lines.

    Inputs and outputs. Four required strings, two string outputs:

    • db_name (STRING, default variation_prompts.db) - the database file. If it doesn't exist it's created.
    • original_image_path (STRING) - the source image's path.
    • variation_image_path (STRING) - the path of the generated variation.
    • variation_image_prompt (STRING, multiline) - the prompt that produced it.
    • database_path (STRING) - absolute path to the DB, so you can find it later.
    • stats (STRING) - the four-line counts summary; wire it to a Show Text node for an at-a-glance log.

    Note there's no IMAGE input - this node logs paths, not pixels. To use it in practice you feed it the file_path/folder_path strings from a save node (like Save_Image_And_Caption from this same pack, or any path-producing node).

    Installing it. The usual pack install:

    cd ComfyUI/custom_nodes
    git clone https://github.com/sneccc/comfyui-snek-nodes
    

    or search "comfyui-snek-nodes" in ComfyUI Manager and restart. No model downloads, no third-party Python beyond the stdlib.

    Where people get burned.

    • The database lives inside the pack folder. It's created at custom_nodes/comfyui-snek-nodes/variation_prompts.db, not in your output directory. That means a git pull or a re-clone of the pack can wipe your whole log. If you're logging something you care about, this is a strong reason to back it up or copy it out periodically - or open a workflow issue asking for a configurable path.
    • No path separators in the name. db_name deliberately rejects /, \, and : so you can't nest the DB in subdirectories. You get a ValueError if you try.
    • Every run appends a row. There's no dedup, no "only if the prompt changed." Re-queue a workflow and the same combination gets another row. The stats' distinct counts are your real signal, not the total.
    • The category shows as ?? Snek Nodes. It's a cosmetic typo in the source - the emoji got mangled - but if you're searching for the node by category and it's not under the snake, that's why.

    Bottom line. A small, honest logging node with one real design flaw (the DB location). If you want a queryable record of your variation experiments and don't mind babysitting the file's location, it does exactly what it says - and the stats output makes it easy to see at a glance whether your loop is actually producing variety.

    Category?? Snek Nodes

    Inputs (4)

    NameTypeDefaultDescription
    db_nameSTRINGvariation_prompts.db
    original_image_pathSTRING
    variation_image_pathSTRING
    variation_image_promptSTRING

    Outputs (2)

    NameTypeDescription
    database_pathSTRING
    statsSTRING