Databases Overview
Memori is database-agnostic. With the BYODB (Bring Your Own Database) approach, your data stays on your infrastructure — you choose the database, you own the data.
Want a zero-setup option? Try Memori Cloud at app.memorilabs.ai.
Supported Databases
| Database | Best For | Driver | Connection String |
|---|---|---|---|
| CockroachDB | Distributed SQL, global scale | psycopg2-binary | cockroachdb+psycopg2://user:pass@host/db |
| MariaDB | MySQL-compatible alternative | pymysql or mysqlclient | mysql+pymysql://user:pass@host/db |
| MongoDB | Document-oriented, flexible schema | pymongo | mongodb://host:27017 |
| MySQL | Existing MySQL infrastructure | pymysql or mysqlclient | mysql+pymysql://user:pass@host/db |
| Neon | Serverless PostgreSQL | psycopg2-binary | postgresql://user:pass@ep-xxx.neon.tech/db |
| OceanBase | Distributed HTAP workloads | pyobvector | mysql+pyobvector://user:pass@host:2881/db |
| Oracle | Enterprise environments | oracledb or cx_Oracle | oracle+oracledb://user:pass@host/service |
| PostgreSQL | Production, high concurrency | psycopg | postgresql+psycopg://user:pass@host/db |
| SQLite | Development, prototyping | Built-in (sqlite3) | sqlite:///memori.db |
| Supabase | Hosted PostgreSQL with extras | psycopg2-binary | postgresql://user:pass@db.xxx.supabase.co:5432/db |
| TiDB | Distributed MySQL-compatible SQL | pymysql or mysqlclient | mysql+pymysql://user:pass@host:4000/db |
MariaDB uses the same drivers and connection strings as MySQL. TiDB is also MySQL-compatible, but Memori will auto-detect it and route it through a dedicated TiDB integration path. Neon and Supabase are PostgreSQL-compatible — see the PostgreSQL page for full setup details.
Managed Providers
Memori also works with hosted services that expose standard PostgreSQL/MySQL endpoints:
| Provider | Engine Compatibility | Typical Host Pattern |
|---|---|---|
| AWS Aurora | PostgreSQL/MySQL | *.rds.amazonaws.com |
| AWS RDS | PostgreSQL/MySQL | *.rds.amazonaws.com |
| Neon | PostgreSQL | *.neon.tech |
| Supabase | PostgreSQL | *.supabase.co |
| TiDB Cloud | TiDB / MySQL | *.tidbcloud.com |
Quick Start Code
from memori import Memori
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
engine = create_engine(
"cockroachdb+psycopg2://user:password@localhost:26257/memori_db",
pool_pre_ping=True
)
SessionLocal = sessionmaker(bind=engine)
mem = Memori(conn=SessionLocal)
mem.config.storage.build()
Connection Methods
Memori supports four connection methods depending on your stack:
| Method | Description | Use Case |
|---|---|---|
| SQLAlchemy | Industry-standard ORM with sessionmaker | Production applications, connection pools |
| DB API 2.0 | Direct Python database drivers (PEP 249) | Lightweight, minimal dependencies |
| Django ORM | Native Django ORM integration | Django applications |
| MongoDB | Function returning a database object | Document databases via pymongo |
Memori accepts a conn parameter — a callable that returns a new connection each time it is called.
- SQLAlchemy databases (SQLite, PostgreSQL, MySQL, MariaDB, TiDB, Oracle, CockroachDB, OceanBase, plus providers like Neon/Supabase/RDS/Aurora/TiDB Cloud): pass a
sessionmaker - DB API 2.0: pass a function that returns a PEP 249 connection object
- Django ORM: use Django's native ORM integration
- MongoDB: pass a function returning a database instance