SQLite¶
The default backend. Zero-config, single-file storage using sqlite-vec for vectors and FTS5 for text search.
When to use¶
- Local development
- Single-process applications
- Prototyping and testing
- Embedded or edge deployments
Setup¶
No extra dependencies — SQLite is included by default.
Python
from memv import Memory
from memv.embeddings import OpenAIEmbedAdapter
from memv.llm import PydanticAIAdapter
memory = Memory(
db_url="memory.db",
embedding_client=OpenAIEmbedAdapter(),
llm_client=PydanticAIAdapter("openai:gpt-4o-mini"),
)
Parent directories are created automatically. db_url=".db/my_app/memory.db" works out of the box.
How it works¶
| Component | Implementation |
|---|---|
| MessageStore | Regular SQL tables |
| EpisodeStore | SQL + JSON (TEXT column) |
| KnowledgeStore | SQL + JSON, bi-temporal columns |
| VectorIndex | sqlite-vec virtual table + mapping table for user filtering |
| TextIndex | FTS5 virtual table + mapping table for user filtering |
sqlite-vec and FTS5 use virtual tables that don't support WHERE clauses directly. memv uses a mapping table pattern to enable per-user filtering — a separate table maps UUIDs to rowids and user IDs, joined at query time.
Limitations¶
- Single-process only — SQLite uses file-level locking. Concurrent writes from multiple processes will fail.
- L2 distance only — sqlite-vec supports Euclidean distance, not cosine similarity.
- No concurrent connections — one connection per store instance.
File location¶
The database file is a single .db file containing all tables. To reset, delete the file.