Skip to main content

polars-redis

Query Redis like a database. Transform with Polars. Write back without ETL.

New to Polars? Polars is a lightning-fast DataFrame library for Python and Rust. Check out the Polars User Guide to get started.

CI PyPI Crates.io Downloads Python Docs License

What is polars-redis?

polars-redis makes Redis a first-class data source in your Polars workflows. Query, transform, and write back - Redis becomes just another connector alongside Parquet, CSV, and databases.

import polars as pl
import polars_redis as redis

# Redis is just another source
users = redis.read_hashes(url, "user:*", schema)
orders = pl.read_parquet("s3://bucket/orders.parquet")

# Full Polars transformation power
result = (
    users.join(orders, on="user_id")
    .group_by("region")
    .agg(pl.col("amount").sum())
)

# Write back to Redis
redis.write_hashes(result, url, key_prefix="region_stats:")

Installation

pip install polars-redis

When to Use What

Your data Use Why
User profiles, configs scan_hashes() Field-level access, projection pushdown
Nested documents scan_json() Full document structure
Counters, flags, caches scan_strings() Simple key-value
Tags, memberships scan_sets() Unique members
Queues, recent items scan_lists() Ordered elements
Leaderboards, rankings scan_zsets() Score-based ordering

Quick Start

import polars as pl
import polars_redis as redis

url = "redis://localhost:6379"

# Scan with schema
lf = redis.scan_hashes(
    url,
    pattern="user:*",
    schema={"name": pl.Utf8, "age": pl.Int64, "active": pl.Boolean},
)

# Filter and collect (projection pushdown applies)
active_users = lf.filter(pl.col("active")).select(["name", "age"]).collect()

# Write with TTL
redis.write_hashes(active_users, url, key_prefix="cache:user:", ttl=3600)

RediSearch (Server-Side Filtering)

from polars_redis import col

# Filter in Redis, not Python - only matching docs are transferred
df = redis.search_hashes(
    url,
    index="users_idx",
    query=(col("age") > 30) & (col("status") == "active"),
    schema={"name": pl.Utf8, "age": pl.Int64, "status": pl.Utf8},
).collect()

# Server-side aggregation
df = redis.aggregate_hashes(
    url,
    index="users_idx",
    query="*",
    group_by=["@department"],
    reduce=[("COUNT", [], "count"), ("AVG", ["@salary"], "avg_salary")],
)

Parallel Fetching

# Speed up large scans with parallel workers
lf = redis.scan_hashes(
    url,
    pattern="user:*",
    schema={"name": pl.Utf8, "age": pl.Int64},
    parallel=4,  # Use 4 parallel workers
)

Features

Read:

  • scan_hashes() / read_hashes() - Redis hashes
  • scan_json() / read_json() - RedisJSON documents
  • scan_strings() / read_strings() - Redis strings
  • scan_sets() / read_sets() - Redis sets
  • scan_lists() / read_lists() - Redis lists
  • scan_zsets() / read_zsets() - Redis sorted sets
  • Projection pushdown (fetch only requested fields)
  • Schema inference (infer_hash_schema(), infer_json_schema())
  • Metadata columns (key, TTL, row index)
  • Parallel fetching for improved throughput

RediSearch (Predicate Pushdown):

  • search_hashes() - Server-side filtering with FT.SEARCH
  • aggregate_hashes() - Server-side aggregation with FT.AGGREGATE
  • Polars-like query builder: col("age") > 30

Write:

  • write_hashes(), write_json(), write_strings()
  • write_sets(), write_lists(), write_zsets()
  • TTL support
  • Key prefix
  • Write modes: fail, replace, append

Supported Types

Polars Redis
Utf8 string
Int64 parsed int
Float64 parsed float
Boolean true/false, 1/0, yes/no
Date YYYY-MM-DD or epoch days
Datetime ISO 8601 or Unix timestamp

Requirements

  • Python 3.9+
  • Redis 7.0+ (RedisJSON module for JSON support)

Documentation

Full documentation at joshrotenberg.github.io/polars-redis

License

MIT or Apache-2.0

Metadata

Release files for polars-redis 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for polars-redis 0.1.6
File Size Uploaded Provenance Actions
polars_redis-0.1.6.tar.gz 305.5 kB With provenance Details for polars_redis-0.1.6.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for polars-redis 0.1.6
File Actions
polars_redis-0.1.6-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details for polars_redis-0.1.6-cp314-cp314-macosx_11_0_arm64.whl
polars_redis-0.1.6-cp314-cp314-macosx_10_12_x86_64.whl CPython 3.14 CPython 3.14 macOS 10.12+ x86-64 Details for polars_redis-0.1.6-cp314-cp314-macosx_10_12_x86_64.whl
polars_redis-0.1.6-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details for polars_redis-0.1.6-cp39-cp39-win_amd64.whl
polars_redis-0.1.6-cp38-cp38-manylinux_2_24_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.24+ x86-64 Details for polars_redis-0.1.6-cp38-cp38-manylinux_2_24_x86_64.whl

Total release size: 9.2 MB

Release files / polars_redis-0.1.6.tar.gz

Download URL polars_redis-0.1.6.tar.gz
Size 305.5 kB
Tags Source
SHA-256 checksum
How to use checksums
67a4754142bd77093d4c43b459a0d257449a251661d3e86abb722f370c5f7002
BLAKE2b-256 checksum
How to use checksums
9554d1f6aee7a893fb511c7e5eb59e9b6ae99e2b0b047cd2ae478ab37dc4e7a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 6, 2026.

Transparency log

Release files / polars_redis-0.1.6-cp314-cp314-macosx_11_0_arm64.whl

Download URL polars_redis-0.1.6-cp314-cp314-macosx_11_0_arm64.whl
Size 2.1 MB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
0790567eba8f916051c8efb0a157c9452628561be2f0e250260452469a05c92a
BLAKE2b-256 checksum
How to use checksums
d29cd26741aa2db7d19c85ca176fb0b552d395201c0911b2221393685ee9fb0e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 6, 2026.

Transparency log

Release files / polars_redis-0.1.6-cp314-cp314-macosx_10_12_x86_64.whl

Download URL polars_redis-0.1.6-cp314-cp314-macosx_10_12_x86_64.whl
Size 2.2 MB
Tags CPython 3.14 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
dadd8e312500dd5bb6f1504a124d58f2f1ad8cf7b993fe2511ab31af94865b2f
BLAKE2b-256 checksum
How to use checksums
9228cf2463a8a5f5fe04d742695357dc7cda57e0b07548d4321cfbfd4393bf75
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 6, 2026.

Transparency log

Release files / polars_redis-0.1.6-cp39-cp39-win_amd64.whl

Download URL polars_redis-0.1.6-cp39-cp39-win_amd64.whl
Size 2.0 MB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
26d8e56fb80330548d605355e9d1e8565fc9f690e71be857f86e4e449c63f654
BLAKE2b-256 checksum
How to use checksums
d09bfe5614210c13560e57fef742bceb0bb3d1de3dd15f6ff407d5236a8b9e7c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 6, 2026.

Transparency log

Release files / polars_redis-0.1.6-cp38-cp38-manylinux_2_24_x86_64.whl

Download URL polars_redis-0.1.6-cp38-cp38-manylinux_2_24_x86_64.whl
Size 2.6 MB
Tags CPython 3.8 Linux glibc 2.24+ x86-64
SHA-256 checksum
How to use checksums
5aec490480d94f75ec651b7896e2a7ac2fc0e3b7fa9517d35b347879ae0b91be
BLAKE2b-256 checksum
How to use checksums
9ea1eda4b07cc8234d233856db63f313912c67af1b86fb032f4acf70b413c2f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 6, 2026.

Transparency log

Security for polars-redis 0.1.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 5 files in this release have been uploaded with provenance metadata.

Select from 5 files

Attestation for polars_redis-0.1.6.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 6, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page