SQLite Store
Lightweight SQLite MetadataStore using Grove ORM with sqlitedriver.
The store/sqlite package provides a SQLite-backed MetadataStore using the Grove ORM with sqlitedriver. It is suitable for embedded applications, CLI tools, and single-node services that don't require a separate database server.
Installation
go get github.com/xraph/weave/store/sqliteSetup
import (
"github.com/xraph/grove"
"github.com/xraph/grove/drivers/sqlitedriver"
sqlitestore "github.com/xraph/weave/store/sqlite"
)
// Open a SQLite connection via Grove's sqlitedriver.
db := grove.Open(sqlitedriver.New("weave.db"))
store := sqlitestore.New(db)Migrations
if err := store.Migrate(ctx); err != nil {
log.Fatal("migrate:", err)
}Creates the same three tables as the PostgreSQL store (weave_collections, weave_documents, weave_chunks) using the Grove migration orchestrator with SQLite-compatible column types.
Pairing with a vector store
SQLite does not support pgvector. Pair it with the in-memory vector store for single-node use:
import (
sqlitestore "github.com/xraph/weave/store/sqlite"
memvec "github.com/xraph/weave/vectorstore/memory"
)
eng, err := engine.New(
engine.WithStore(sqlitestore.New(db)),
engine.WithVectorStore(memvec.New()),
engine.WithEmbedder(emb),
)Internals
| Aspect | Detail |
|---|---|
| Driver | Grove ORM with sqlitedriver (SQLite) |
| Migrations | Grove migration orchestrator with programmatic migrations |
| Transactions | Database-level transactions via SQLite |
Lifecycle
| Method | Behaviour |
|---|---|
Migrate(ctx) | Creates tables and indexes using the Grove migration orchestrator |
Ping(ctx) | Verifies database connectivity |
Close() | Closes the underlying database connection |
When to use
- Local development -- single-file database, no server process required.
- Testing -- fast, isolated store with no external dependencies.
- Embedded / single-process -- CLI tools, desktop apps, or edge deployments.
- CI pipelines -- deterministic tests without a database container.
Limitations
- Single-writer -- SQLite uses database-level write locks. High write concurrency will serialize.
- No pgvector -- vector similarity search requires a separate vector store.
- Not horizontally scalable -- suited for single-process or embedded use.