skillfed

redis-om

Object mappings, and more, for Redis.

redis-om v1.1.0 242.9K downloads/30d#8,832 on PyPI1,314
Permissive license BSD-3-Clause Active released

What it is and what it does

Redis OM is a Python library that bridges Pydantic models and Redis storage, letting you define data schemas as Python classes with type annotations and automatically handle serialization, validation, and persistence. It generates unique primary keys, manages expiration, and provides fluent query APIs when RediSearch is available. The library sits on top of the redis client and integrates Pydantic's validation system, so any Pydantic validator (like EmailStr) works as a field type. Basic operations—creating, saving, retrieving, and expiring objects—work with any Redis instance; richer query expressions and embedded models require RediSearch and RedisJSON modules.

You define a model by subclassing HashModel or other base classes, annotate fields with Python types, then call save() to persist to Redis and use class methods like get() or find() to retrieve data. The library automatically manages indexes when configured and handles the Redis protocol details, so you work with Python objects rather than raw key-value commands.

Use it for:

  • Build a user or customer database in Redis with automatic validation and type safety using Pydantic field types like EmailStr.
  • Query Redis data using Python expressions (e.g., Customer.find(Customer.age > 30)) when RediSearch is installed.
  • Persist application state or cache objects with automatic expiration and unique key generation without manual Redis commands.
  • Define nested data structures with embedded models and let Redis OM handle serialization to Redis hashes or JSON.
  • Migrate from a traditional ORM to Redis while keeping familiar declarative model syntax and validation rules.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Redis OM provides declarative object mapping and data validation for Redis, letting you define Python models with type annotations that automatically serialize to and query from Redis with Pydantic validation.

Yes, if you are already using Redis and want to avoid raw key-value code. The library is actively maintained, has no security vulnerabilities, and low install friction. It is worth installing for projects that benefit from Pydantic validation and declarative models; however, confirm that your Redis deployment includes RediSearch and RedisJSON if you need advanced querying beyond basic save/get operations.

Install

redis-om on PyPI

pip

pip install redis-om

uv

uv add redis-om

poetry

poetry add redis-om

Installing redis-om

Before you install

Low friction: pure Python wheel with no compiled dependencies. Actively maintained with recent commits and a stable release cycle. Requires Python 3.10 or later and a Redis instance with optional RediSearch and RedisJSON modules for advanced querying.

License in practice

BSD-3-Clause is permissive; you can use this in commercial and proprietary projects with minimal restrictions, provided you include the license text and do not misrepresent authorship.

Quickstart

pip install redis-om

from redis_om import HashModel
from pydantic import EmailStr
import datetime

class Customer(HashModel):
    first_name: str
    email: EmailStr
    join_date: datetime.date

customer = Customer(
    first_name="Alice",
    email="alice@example.com",
    join_date=datetime.date.today()
)
customer.save()
retrieved = Customer.get(customer.pk)

Requires a running Redis instance (e.g., via docker run -p 6379:6379 redis/redis-stack). RediSearch and RedisJSON modules are optional but needed for advanced querying with find().

Verify before relying

  • Whether RediSearch and RedisJSON modules are required for basic object mapping or only for advanced query features
  • Performance characteristics when working with large datasets or high-throughput scenarios
  • Compatibility guarantees with different Redis versions or Redis Enterprise

Package facts

License BSD-3-Clause (permissive)
Python support supports the current Python release (<4.0,>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 11 — click, hiredis, more-itertools, pydantic-extra-types, pydantic, python-ulid, redis, redisvl, setuptools, types-redis, typing-extensions
Maintenance actively maintained — 154 days since the last release
Last repo commit
First released
Downloads 242,878/month — #8,832 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: redis_om-1.1.0-py3-none-any.whl

Development Status :: 5 - Production/StableEnvironment :: ConsoleIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Topic :: Database

Tags

redis object mapping pythonredis orm pydantic modelsredis data validation serializationredis query builder pythonredis hash model persistenceredis secondary indexesredis declarative models
ormredis-clientpydantic-integration

More Database packages

psycopg2-binary

psycopg2-binary is a PostgreSQL database…

copyleft · top 1,000 on PyPI

redis

Python client library for connecting to and…

permissive · top 1,000 on PyPI

ydb

YDB Python SDK is the official client library…

permissive · top 1,000 on PyPI

snowflake-connector-python

Connects Python applications to Snowflake data…

permissive · top 1,000 on PyPI

sqlparse

sqlparse tokenizes SQL text into a tree of…

permissive · top 1,000 on PyPI

dbt-adapters

Provides base adapter protocols and shared…

permissive · top 1,000 on PyPI

sqlmodel

SQLModel combines SQLAlchemy and Pydantic to…

permissive · top 5,000 on PyPI

jsonschema-pydantic-converter

Converts JSON Schema definitions to Pydantic v2…

permissive · top 15,000 on PyPI

jambo

Converts JSON Schema definitions into Pydantic…

permissive · top 15,000 on PyPI

SQLAlchemy

SQLAlchemy is a Python SQL toolkit and Object…

permissive · top 100 on PyPI

redis-simple-mq

A lightweight message queue built on Redis that…

permissive · top 15,000 on PyPI

param

Param provides declarative class attributes…

permissive · top 5,000 on PyPI

json-schema-to-pydantic

Automatically generates Pydantic v2 models from…

permissive · top 5,000 on PyPI

langgraph-checkpoint-redis

Provides Redis-backed checkpoint storage and…

permissive · top 5,000 on PyPI

ormar

An async ORM for Python that unifies database…

permissive · top 15,000 on PyPI

dataclasses-avroschema

Generates Avro schemas from Python dataclasses,…

permissive · top 5,000 on PyPI