--- id: redis-om version: "1.1.0" license: BSD-3-Clause license_treatment: permissive maintenance: active --- # redis-om — Object mappings, and more, for Redis. License: permissive · Maintenance: active · Downloads: 242.9K/mo ## 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 above — 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 pip install redis-om uv add redis-om 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_current - Install friction: low - Maintenance: active - Downloads: 242.9K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags redis object mapping python, redis orm pydantic models, redis data validation serialization, redis query builder python, redis hash model persistence, redis secondary indexes, redis declarative models, orm, redis-client, pydantic-integration [View on SkillFed](https://skillfed.io/packages/redis-om) · [View on PyPI](https://pypi.org/project/redis-om/)