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

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
MariaDBMySQL-compatible alternativepymysql 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
OceanBaseDistributed HTAP workloadspyobvectormysql+pyobvector://user:pass@host:2881/db
NeonServerless PostgreSQLpsycopg2-binarypostgresql://user:pass@ep-xxx.neon.tech/db
SupabaseHosted PostgreSQL with extraspsycopg2-binarypostgresql://user:pass@db.xxx.supabase.co:5432/db

MariaDB uses the same drivers and connection strings as MySQL. 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:

ProviderEngine CompatibilityTypical Host Pattern
NeonPostgreSQL*.neon.tech
SupabasePostgreSQL*.supabase.co
AWS RDSPostgreSQL/MySQL*.rds.amazonaws.com
AWS AuroraPostgreSQL/MySQL*.rds.amazonaws.com

Quick Start Code

Database Setup
import sqlite3
from memori import Memori

def get_connection():
    return sqlite3.connect("memori.db")

mem = Memori(conn=get_connection)
mem.config.storage.build()

Connection Methods

Memori supports four connection methods depending on your stack:

MethodDescriptionUse Case
SQLAlchemyIndustry-standard ORM with sessionmakerProduction applications, connection pools
DB API 2.0Direct Python database drivers (PEP 249)Lightweight, minimal dependencies
Django ORMNative Django ORM integrationDjango applications
MongoDBFunction returning a database objectDocument 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, Oracle, CockroachDB, OceanBase, plus providers like Neon/Supabase/RDS/Aurora): 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