Introduction
KiteSQL is a lightweight embedded relational database for Rust, inspired by MyRocks and SQLite and fully written in Rust. It is designed to work not only as a SQL engine, but also as a Rust-native data API that can be embedded directly into applications without relying on external services or heavyweight infrastructure.
KiteSQL supports direct SQL execution, typed ORM models, schema migration, and builder-style queries, so you can combine relational power with an API surface that feels natural in Rust.
Key Features
- A lightweight embedded SQL database fully rewritten in Rust
- A Rust-native relational API alongside direct SQL execution
- Typed ORM models with migrations, CRUD helpers, and a lightweight query builder
- Higher write speed with an application-friendly embedding model
- All metadata and actual data in KV storage, with no intermediate stateful service layer
- Extensible storage integration for customized workloads
- Supports most of the SQL 2016 syntax
- Ships a WebAssembly build for JavaScript runtimes
👉check more
ORM
KiteSQL includes a built-in ORM behind the orm feature flag. With #[derive(Model)], you can define typed models and get tuple mapping, CRUD helpers, schema creation, migration support, and builder-style single-table queries.
Schema Migration
Model changes are part of the normal workflow. KiteSQL ORM can help evolve tables for common schema updates, including adding, dropping, renaming, and changing columns, so many migrations can stay close to the Rust model definition instead of being managed as hand-written SQL.
For the full ORM guide, see src/orm/README.md.
Examples
use DataBaseBuilder;
use DatabaseError;
use Model;
👉more examples
WebAssembly
- Build:
wasm-pack build --release --target nodejs(outputs to./pkg; use--target webor--target bundlerfor browser/bundler setups). - Usage:
import from "./pkg/kite_sql.js";
const db = ;
await db.;
await db.;
const rows = db..;
console.log;
- In Node.js, provide a small
localStorageshim if you enable statistics-related features (seeexamples/wasm_index_usage.test.mjs).
Python (PyO3)
- Enable bindings with Cargo feature
python. - Constructor is explicit:
Database(path); in-memory usage isDatabase.in_memory(). - Minimal usage:
=
TPC-C
Run make tpcc (or cargo run -p tpcc --release) to execute the benchmark against the default KiteSQL storage.
Run make tpcc-dual to mirror every TPCC statement to an in-memory SQLite database alongside KiteSQL and assert the two engines return identical results; this target runs for 60 seconds (--measure-time 60). Use cargo run -p tpcc --release -- --backend dual --measure-time <secs> for a custom duration.
- i9-13900HX
- 32.0 GB
- KIOXIA-EXCERIA PLUS G3 SSD
- Tips: TPC-C currently only supports single thread
All cases have been fully optimized.
<90th Percentile RT (MaxRT)>
New-Order : 0.002 (0.005)
Payment : 0.001 (0.013)
Order-Status : 0.002 (0.006)
Delivery : 0.010 (0.023)
Stock-Level : 0.002 (0.017)
<TpmC>
27226 Tpmc
👉check more
Roadmap
- Get SQL 2016 mostly supported
- LLVM JIT: Perf: TPCC
License
KiteSQL uses the Apache 2.0 license to strike a balance between open contributions and allowing you to use the software however you want.