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 |
|---|---|---|---|
| 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 |
| MariaDB | MySQL-compatible alternative | 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 |
| OceanBase | Distributed HTAP workloads | pyobvector | mysql+pyobvector://user:pass@host:2881/db |
| Neon | Serverless PostgreSQL | psycopg2-binary | postgresql://user:[email protected]/db |
| Supabase | Hosted PostgreSQL with extras | psycopg2-binary | postgresql://user:[email protected]:5432/db |
MariaDB uses the same drivers and connection strings as MySQL. Neon and Supabase are PostgreSQL-compatible.
Managed Providers
Memori also works with hosted services that expose standard PostgreSQL/MySQL endpoints:| Provider | Engine Compatibility | Typical Host Pattern |
|---|---|---|
| Neon | PostgreSQL | *.neon.tech |
| Supabase | PostgreSQL | *.supabase.co |
| AWS RDS | PostgreSQL/MySQL | *.rds.amazonaws.com |
| AWS Aurora | PostgreSQL/MySQL | *.rds.amazonaws.com |
Quick Start Code
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 |
conn parameter — a callable that returns a new connection each time it is called.
SQLAlchemy Databases
For SQLite, PostgreSQL, MySQL, MariaDB, Oracle, CockroachDB, OceanBase, and managed providers like Neon/Supabase/RDS/Aurora: pass asessionmaker.
DB API 2.0
For direct database connections using PEP 249-compliant drivers: pass a function that returns a connection object.Django ORM
For Django applications, pass your Django database connection directly.MongoDB
For MongoDB: pass a function returning a database instance.Database Tables
When you runmem.config.storage.build(), Memori creates these tables:
memori_conversation_message- Raw conversation messagesmemori_entity_fact- Extracted facts about entitiesmemori_process_attribute- Process-specific attributesmemori_knowledge_graph- Relationship graph datamemori_session- Session tracking
Since you own the database, you can query these tables directly for custom analytics, backups, or integration with other systems.
Inspect Your Memories
Query your database directly to see what Memori stored:Next Steps
Quick Start with SQLite
Build your first memory-enabled application in under 3 minutes.Go to Quick Start →
Database-Specific Guides
Explore detailed setup guides for each database in the sidebar.View database guides in the sidebar