Skip to content
DuckDB community extension

infera

A DuckDB extension for in-database inference

01 / SETUP

Install and load

Run these commands in a Haybarn SQL session. The extension is available from the community repository.

Haybarn 2.0.0 · SQL
INSTALL infera FROM community;
LOAD infera FROM community;

Try it in a temporary SQL session with infera already loaded. Queries run in this tab; examples using files or services need their own setup.

Using upstream DuckDB? Follow the maintainer’s installation instructions.

02 / QUERY

Usage example

0. Assuming the extension is already installed and loaded

SQL
-- 0. Assuming the extension is already installed and loaded

-- 1. Load a simple linear model from a remote URL
SELECT infera_load_model('linear_model',
'https://github.com/CogitatorTech/infera/raw/refs/heads/main/test/models/linear.onnx');

-- 2. Run a prediction using a very simple linear model
-- Model: y = 2*x1 - 1*x2 + 0.5*x3 + 0.25
SELECT infera_predict('linear_model', 1.0, 2.0, 3.0);
-- Expected output: 1.75

-- 3. Unload the model when we're done with it
SELECT infera_unload_model('linear_model');

-- 4. Check the Infera version
SELECT infera_get_version();

Provided by CogitatorTech. Not yet verified on Haybarn 2.0.0.

Sample data & setup

About this extension

Infera extension allows users to use machine learning models directly in SQL queries to perform inference on data stored in DuckDB tables. It is developed in Rust and uses Tract as the backend inference engine. Infera supports loading and running models in ONNX format. Check out the ONNX Model Zoo repository on Hugging Face for a large collection of ready-to-use models that can be used with Infera.

For more information, like API references and usage examples, visit the project's GitHub repository.

Project overview from the community descriptor.

Documentation and resources

Project and build details
Repository
CogitatorTech/infera
License
MIT OR Apache-2.0
Maintainers
habedi
Written in
Rust & C++
Build source
d70d4f1f8df2
Build definition
Community descriptor