Nodes/ComfyDL/Read AccDB → Dataset
ComfyUI Node

Read AccDB → Dataset

The one ComfyDL node where the driver, not the node, is the problem

By Cynthia-lxx·Created 3 months ago·Updated 12 days ago· 7
Read AccDB → Dataset
    • dataset
    ◄db_path►
    ◄querySELECT * FROM data►
    ◄target►
    ◄dtypefloat32►

    What it is

    ComfyDL is Cynthia-lxx's pack for deep learning as ComfyUI graphs - d2l-derived trainers and primitives that all speak one universal DATASET type (features, optional labels, column names, passed by reference). Read AccDB → Dataset is the reader for Microsoft Access databases: you give it a .accdb or .mdb file and a SQL query, and you get a dataset out the other side.

    Access files are still out there in the world - small-business exports, plant-floor logs, twenty-year-old departmental databases. If someone hands you one and you'd rather not open Access, this is the node for the job. Fair warning: of the seven readers in the pack it is by far the most likely to fight you, and the fight is never about ComfyDL. It's about ODBC.

    How it works

    execute lazily imports pyodbc (lazily, so a missing package gives you a readable pip install pyodbc message instead of breaking the whole pack on startup), then opens a connection with the driver string hard-coded:

    pyodbc.connect(f"Driver={{Microsoft Access Driver (*.mdb, *.accdb)}};DBQ={db_path};")
    

    Everything after that is normal: pd.read_sql(query, conn) into a DataFrame, then CdlDataset.from_dataframe strips the target column into a labels tensor and casts the remaining columns to float32/float64. So once the connection works, the behaviour is identical to Read DB → Dataset.

    The hard-coded driver name is the crux. It has to exist on your machine with exactly that name, and it has to match your Python's bitness.

    Inputs and outputs

    Required: db_path (no useful default - it ships empty, so you must fill it), query (multiline, default SELECT * FROM data), and target (label column, empty for unlabelled). Optional: dtype.

    Output: one dataset.

    Install

    Manager → search ComfyDL, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Cynthia-lxx/ComfyDL
    pip install -r ./ComfyDL/requirements.txt
    

    Then install the two things this node needs and the pack does not provide:

    pip install pyodbc
    

    …plus the Microsoft Access Database Engine (the "ACE" redistributable) from Microsoft, which is the part people skip. The pack's own requirements list is just matplotlib, IPython and matplotlib-inline; pyodbc and the ODBC driver are yours to handle, and the source's error message says so in as many words.

    Where people get burned

    32-bit driver, 64-bit Python. This is the classic. ACE ships in 32-bit and 64-bit builds, your ComfyUI Python is almost certainly 64-bit, and the driver has to match or you get Data source name not found and no default driver specified even though Access works fine on the same machine. Note that installing the 64-bit ACE sometimes fails because Office 32-bit is present - you may need the /quiet installer or to remove the conflicting Office component.

    A different driver name. If your machine only has an older Microsoft Access Driver (*.mdb), or a vendor-named variant, the connection string the node builds won't match anything. There's no field to change it - this is a source edit, not a widget.

    Linux and macOS. There is effectively no Access ODBC driver there. If you're running ComfyUI on Linux, the honest answer is to stop trying: open the file in LibreOffice Base or convert with mdb-tools and hand the result to Read CSV → Dataset.

    db_path empty. The default is an empty string, which builds a connection string with a blank DBQ= and fails - you always have to type the path. Absolute paths with forward slashes behave best.

    Text columns in the query result. Same rule as every reader in the pack: everything that isn't the target becomes a float feature, so selecting a name or a timestamp column breaks the conversion. Name your columns.

    Access SQL is its own dialect. TOP 100 instead of LIMIT, date literals in #...#, and some functions differ from SQLite. A query that works in any other reader may need rewriting here.

    Don't build a pipeline on it. If this is a recurring job, convert the Access file to SQLite or CSV once and point Read DB → Dataset or Read CSV → Dataset at that. The driver ambiguity disappears, and you'll never explain bitness to anyone again.

    Categoryd2l/Datasets

    Inputs (4)

    NameTypeDefaultDescription
    db_pathSTRING—
    querySTRINGSELECT * FROM data—
    targetSTRING—
    dtypeoptCOMBOfloat322 options: float32, float64

    Outputs (1)

    NameTypeDescription
    datasetDATASET—