explaingit

loloxwg/duckdb-onnx

Analysis updated 2026-07-08 · repo last pushed 2025-04-09

4C++Audience · dataComplexity · 4/5StaleSetup · hard

TLDR

A DuckDB extension that lets you run ONNX machine learning models directly inside SQL queries, so you can get predictions without exporting your data to a separate tool.

Mindmap

mindmap
  root((repo))
    What it does
      Runs ONNX models in SQL
      Adds onnx function
      Returns model output as results
    Tech stack
      C++
      DuckDB extension template
      VCPKG dependency manager
    Use cases
      Score data in database
      Add ML predictions to queries
      Avoid exporting data
    Audience
      Data analysts
      Data scientists
      Developers
    Status
      Early experimental stage
      Has working example
      Documentation incomplete
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Run a machine learning model on your database data using a simple SQL query.

USE CASE 2

Classify customer support tickets directly inside your DuckDB data pipeline without writing separate Python scripts.

USE CASE 3

Apply an ONNX model to multiply or transform input values and return results as part of a standard query.

What is it built with?

C++DuckDBONNXVCPKG

How does it compare?

loloxwg/duckdb-onnxaerl-official/aerl-c-frameworkbong-water-water-bong/npu-gpu-cpu
Stars443
LanguageC++C++C++
Last pushed2025-04-09
MaintenanceStale
Setup difficultyhardeasyhard
Complexity4/52/55/5
Audiencedatadeveloperresearcher

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · hard Time to first run · 1h+

Requires building a C++ DuckDB extension from source using VCPKG for dependency management, which needs a configured C++ build environment.

In plain English

This project is an extension for DuckDB (a fast, embeddable data analysis tool) that lets you run ONNX models directly inside your database queries. ONNX is a standard format for machine learning models. The core idea is that instead of exporting your data out of the database to run it through a separate machine learning tool, you can feed data through a model using a simple SQL function. The repository is currently in an early, template-like stage, and the README leaves the broader project goals blank, but it includes a working example where a model multiplies input values. At a high level, the extension adds a custom function called onnx() to DuckDB. You call this function in a SQL query and pass it two things: the file path to an ONNX model, and a set of input values structured with shapes and numbers. In the provided example, passing in a list of numbers through a sample model returns the squared values of those numbers. The function handles passing the data to the model and returning the model's output directly as query results. This tool would be useful for data analysts, data scientists, or developers who already use DuckDB to slice and filter large datasets and want to layer in machine learning predictions. For example, if you have a model trained to classify customer support tickets, you could theoretically use this extension to score incoming tickets right inside your database pipeline without writing a separate Python script. The project is built using C++ and uses a system called VCPKG to manage its dependencies. It is explicitly based on DuckDB's official extension template, meaning the creator used a starter scaffold provided by DuckDB to build this functionality. Because it is still using placeholder text in its documentation, it appears to be a work in progress or an experimental project rather than a finished product ready for production use.

Copy-paste prompts

Prompt 1
Write a DuckDB SQL query that uses the onnx() extension function to pass a list of numbers to an ONNX model file and return the model's output.
Prompt 2
Show me how to install and load the duckdb-onnx extension in DuckDB, and run the provided example where an ONNX model squares input values.
Prompt 3
Help me structure the input arguments for the onnx() function in DuckDB, including the model file path and the input values with their shapes.
Prompt 4
Create a DuckDB SQL pipeline that filters customer support ticket data and then passes the text features through an ONNX classification model using the onnx() function.

Frequently asked questions

What is duckdb-onnx?

A DuckDB extension that lets you run ONNX machine learning models directly inside SQL queries, so you can get predictions without exporting your data to a separate tool.

What language is duckdb-onnx written in?

Mainly C++. The stack also includes C++, DuckDB, ONNX.

Is duckdb-onnx actively maintained?

Stale — no commits in 1-2 years (last push 2025-04-09).

How hard is duckdb-onnx to set up?

Setup difficulty is rated hard, with roughly 1h+ to a first successful run.

Who is duckdb-onnx for?

Mainly data.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.