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

DatabaseBest ForDriverConnection String
SQLiteDevelopment, prototypingBuilt-in (sqlite3)sqlite:///memori.db
PostgreSQLProduction, high concurrencypsycopg2-binarypostgresql://user:pass@host/db
MySQLExisting MySQL infrastructurepymysql or mysqlclientmysql+pymysql://user:pass@host/db
OracleEnterprise environmentsoracledb or cx_Oracleoracle+oracledb://user:pass@host/service
MongoDBDocument-oriented, flexible schemapymongomongodb://host:27017
CockroachDBDistributed SQL, global scalepsycopg2-binarycockroachdb+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