1 unstable release

0.1.0 Jul 22, 2024

#888 in Database interfaces

BSD-3-Clause

26KB
595 lines

DuckDB Server

Crates.io

A Rust-based server that runs a local DuckDB instance and support queries over Web Sockets or HTTP/HTTPS, returning data in either Apache Arrow or JSON format.

Note: This package provides a local DuckDB server. To instead use DuckDB-WASM in the browser, use the wasmConnector in the mosaic-core package.

Usage

Install the server with Cargo or Cargo B(inary)Install.

cargo install duckdb-server
# or
cargo binstall duckdb-server

Then run the server with

duckdb-server

You can disable or customize logging with the RUST_LOG environment variable.

env RUST_LOG="" duckdb-server

The server can reuse existing sockets with listenfd.

systemfd --no-pid -s http::3000 -- duckdb-server

Developers

Build

Build the release binary with

cargo build --release

Develop

To run the server and restart it when the code changes, install cargo-watch and systemfd with

cargo install cargo-watch systemfd

Then run the server with

systemfd --no-pid -s https::3000 -- cargo watch -x run

Or just use (but this won't restart when the code changes)

cargo run

Create certificates for HTTPS with

mkcert localhost

Before sending a pull request, run the tests with

cargo test
cargo clippy
cargo fmt

Update dependencies

Bump the version in Cargo.toml and then run cargo publish.

Dependencies

~41–55MB
~873K SLoC