#duck-db #sql

yanked duckdb2

Simple DuckDB binding for Rust

1 stable release

1.0.0 Sep 8, 2024
0.1.1 Sep 6, 2024
0.1.0 Sep 6, 2024

#23 in #duck-db

MIT license

53KB
1.5K SLoC

duckdb2

Crates.io docs.rs

Simple DuckDB binding for Rust

Usage

cargo add duckdb2
use duckdb2::{Database, Config};

fn main() {
    let config = Config::new();
    let db = Database::open_with("./test.db", config).unwrap();
    let conn = db.connect().unwrap();

    conn.execute("CREATE TABLE IF NOT EXISTS users (id int32, age int8)").unwrap();
    conn.execute("INSERT INTO users VALUES (1, 18), (2, 22), (3, 32);").unwrap();
    
    let query = conn.query("SELECT * FROM users").unwrap();
    dbg!(query);
}

Dependencies

~14MB
~186K SLoC