Databases Overview
Memori is database-agnostic. With the BYOD (Bring Your Own Database) approach, your data stays on your infrastructure — you choose the database, you own the data.
Want a zero-setup option? The hosted platform at app.memorilabs.ai offers 100 memories free without an API key, and 5,000/month with a free API key.
Supported Databases
| Database | Best For | Driver | Connection String |
|---|---|---|---|
| SQLite | Development, prototyping | Built-in (sqlite3) | sqlite:///memori.db |
| PostgreSQL | Production, high concurrency | psycopg2-binary | postgresql://user:pass@host/db |
| MySQL | Existing MySQL infrastructure | pymysql or mysqlclient | mysql+pymysql://user:pass@host/db |
| Oracle | Enterprise environments | oracledb or cx_Oracle | oracle+oracledb://user:pass@host/service |
| MongoDB | Document-oriented, flexible schema | pymongo | mongodb://host:27017 |
| CockroachDB | Distributed SQL, global scale | psycopg2-binary | cockroachdb+psycopg2://user:pass@host/db |
Quick Start Code
Database Setup
from memori import Memori
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
engine = create_engine("sqlite:///memori.db")
SessionLocal = sessionmaker(bind=engine)
mem = Memori(conn=SessionLocal)
mem.config.storage.build()
Connection Pattern
Memori accepts a conn parameter — a callable that returns a new connection each time it is called.
- SQLAlchemy databases (SQLite, PostgreSQL, MySQL, Oracle, CockroachDB): pass a
sessionmaker - MongoDB: pass a function returning a database instance
Next Steps
- Get started quickly: SQLite (zero install)
- Go to production: PostgreSQL (recommended)
- Distributed SQL: CockroachDB
- Configure your preferred LLM Provider