🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

sqlalchemy-memory

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sqlalchemy-memory

In-memory SQLAlchemy 2.0 dialect for blazing‑fast prototyping.

0.4.0
PyPI
Maintainers
1

sqlalchemy-memory

PyPI - Version CI Documentation PyPI - Downloads

In‑memory SQLAlchemy 2.0 dialect for blazing‑fast prototyping

A pure‑Python SQLAlchemy 2.0 dialect that runs entirely in RAM. It avoids typical database I/O and ORM overhead while maintaining full compatibility with the SQLAlchemy 2.0 Core and ORM APIs. Ideal for rapid prototyping, backtesting engines, simulations.

Why ?

This project was inspired by the idea of building a fast, introspectable, no-dependency backend for SQLAlchemy.

It is useful for:

  • Prototyping new applications

  • Educational purposes

  • Testing ORM logic without spinning up a real database engine

Unlike traditional in-memory solutions like SQLite, sqlalchemy-memory fully avoids serialization, connection pooling, and driver overhead, leading to much faster in-memory performance while keeping the familiar SQLAlchemy API.

It is also perfect for applications that need a lightweight, high-performance store compatible with SQLAlchemy, such as backtesting engines, simulators, or other tools where you don't want to maintain a separate in-memory layer alongside your database models.

Data is kept purely in RAM and is volatile: it is not persisted across application restarts and is cleared when the engine is disposed.

Features

  • SQLAlchemy 2.0 support: ORM & Core expressions, sync & async modes
  • Zero I/O overhead: pure in‑RAM storage (dict/list under the hood)
  • Commit/rollback support
  • Index support: indexes are recognized and used for faster lookups
  • Lazy query evaluation: supports generator pipelines and short-circuiting
    • first()-style queries avoid scanning the full dataset
    • Optimized for read-heavy workloads and streaming filters

Benchmark

Curious how sqlalchemy-memory stacks up?

View Benchmark Results comparing sqlalchemy-memory to in-memory SQLite

Installation

pip install sqlalchemy-memory

Documentation

See the official documentation for usage examples

Testing

Simply run make tests

License

This project is licensed under the MIT License. See LICENSE for details.

Keywords

sqlalchemy

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts