6 releases (breaking)

0.5.0 Oct 30, 2023
0.4.0 Oct 27, 2023
0.3.1 Oct 25, 2023
0.2.0 Oct 24, 2023
0.1.0 Oct 20, 2023

#2293 in Database interfaces

38 downloads per month

MIT license

39KB
1K SLoC

QuackDB

A DuckDB API with ergonomic high-level API without sacrificing the ability to go low level.

Compared to duckdb-rs

  • QuackDB avoids lifetime on API where possible
    • Database objects are reference-counted
    • This avoids the need to store parent objects explicitly
  • QuackDB does not attempt to mimic Rusqlite API
  • QuackDB data access and processing is centered around Arrow

API Level

The main API is the high level, safe API.

quackdb-internal contains wrappers over types from libduckdb-sys with Rust types. These types are only used for object lifetime management. Raw FFI handles can be accessed by dereferencing either high level or wrapper structures.

API Support

C API High Level
Database Yes
Connection Yes
Config Yes
Query Arrow
Data Chunks No
Values No
Types Partial
Statements Yes
Appender Yes
Table Functions Almost
Replacement Scans Yes
  • Query results require working with arrow RecordBatch directly
  • Table functions are supported, but it has to work with data chunks directly via FFI
  • Currently, DuckDB types, Arrow types, and Rust types are not fully reconciled

API conventions

  • High level API expose low level handle types as pub handle field
  • High level API follow Rust naming
  • Low level API wraps raw handle and all basic operations
  • Low level API dereferences to raw handle
  • Low level API use Rust types
  • Low level API follow DuckDB naming

Roadmap

  • Arrow streaming support
  • Clean up receivers
  • Clean up table function
  • Remove intermediate handles that does not need Drop implementations
  • Serde support
  • Data chunk support
  • Comprehensive documentation
  • Comprehensive tests

Dependencies

~18–25MB
~312K SLoC