redis-om
Object mappings, and more, for Redis.
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-omuv
uv add redis-ompoetry
poetry add redis-omInstalling 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
Tags
More Database packages
psycopg2-binary is a PostgreSQL database…
copyleft · top 1,000 on PyPI
redisPython client library for connecting to and…
permissive · top 1,000 on PyPI
ydbYDB Python SDK is the official client library…
permissive · top 1,000 on PyPI
snowflake-connector-pythonConnects Python applications to Snowflake data…
permissive · top 1,000 on PyPI
sqlparsesqlparse tokenizes SQL text into a tree of…
permissive · top 1,000 on PyPI
dbt-adaptersProvides base adapter protocols and shared…
permissive · top 1,000 on PyPI
sqlmodelSQLModel combines SQLAlchemy and Pydantic to…
permissive · top 5,000 on PyPI
jsonschema-pydantic-converterConverts JSON Schema definitions to Pydantic v2…
permissive · top 15,000 on PyPI
jamboConverts JSON Schema definitions into Pydantic…
permissive · top 15,000 on PyPI
SQLAlchemySQLAlchemy is a Python SQL toolkit and Object…
permissive · top 100 on PyPI
redis-simple-mqA lightweight message queue built on Redis that…
permissive · top 15,000 on PyPI
paramParam provides declarative class attributes…
permissive · top 5,000 on PyPI
json-schema-to-pydanticAutomatically generates Pydantic v2 models from…
permissive · top 5,000 on PyPI
langgraph-checkpoint-redisProvides Redis-backed checkpoint storage and…
permissive · top 5,000 on PyPI
ormarAn async ORM for Python that unifies database…
permissive · top 15,000 on PyPI
dataclasses-avroschemaGenerates Avro schemas from Python dataclasses,…
permissive · top 5,000 on PyPI