Skip to main content

High-performance database read acceleration layer for MongoDB. Auto-chunks and parallelizes queries across multiple-workers, streams results to parquet with intelligent caching and memory-bounded execution, option to stream data directly to any data lake. Same PyMongo API but dramatically faster results with RUST backend for CPU-heavy tasks.

Reason this release was yanked:

Path issue

Project description

XLR8 Logo

Accelerate MongoDB analytical queries with parallel execution and Parquet caching

Faster Queries → Less Memory → Real Savings

GitHub Python versions License

🦀 Rust-Backed · ⚡ Up to 4x Faster Queries · 📦 10-12x Compression · 📊 Configurable Memory Limits


Minimal Code Changes

# Before: PyMongo
df = pd.DataFrame(list(collection.find(query)))

# After: XLR8 - just wrap and go!
xlr8_collection = accelerate(collection, schema, mongodb_uri)
df = xlr8_collection.find(query).to_dataframe()

That's it. Same query syntax, same DataFrame output - just faster.


The Problem

When running analytical queries over large MongoDB collections, you encounter two fundamental bottlenecks:

I/O Bound: PyMongo uses a single cursor, fetching documents one batch at a time. Your CPU sits idle waiting for network round trips.

CPU/GIL Bound: Even with the data in hand, Python's Global Interpreter Lock (GIL) means BSON decoding and DataFrame construction happen on a single core.

These aren't PyMongo limitations - they're inherent to Python's design. XLR8 provides a solution.


How XLR8 Solves It

XLR8 releases Python's GIL and hands execution to a Rust backend powered by Tokio's async runtime:

  1. Query Planning → Splits your query into time-based chunks
  2. Parallel Workers → Multiple workers fetch from MongoDB simultaneously
  3. BSON → Arrow → Direct conversion without Python overhead
  4. Parquet Caching → Results cached for instant reuse
  5. DataFrame Assembly → Final merge via DuckDB (GIL-free)

The result? Your analytical queries run significantly faster, especially for large result sets.


Installation

pip install xlr8

XLR8 requires Python 3.11+ and includes pre-compiled Rust extensions for Linux, macOS, and Windows.


Quick Start

from pymongo import MongoClient
from xlr8 import accelerate, Schema, Types
from datetime import datetime, timezone, timedelta

# Connect to MongoDB
client = MongoClient("mongodb://localhost:27017")
collection = client["iot"]["sensor_readings"]

# Define your schema
schema = Schema(
    time_field="timestamp",
    fields={
        "timestamp": Types.Timestamp("ms", tz="UTC"),
        "device_id": Types.ObjectId(),
        "reading": Types.Any(),  # Handles int, float, string dynamically
    },
    avg_doc_size_bytes=200,
)

# Wrap collection with XLR8
xlr8_col = accelerate(collection, schema=schema, mongo_uri="mongodb://localhost:27017")

# Query like normal PyMongo
cursor = xlr8_col.find({
    "timestamp": {"$gte": datetime(2024, 1, 1, tzinfo=timezone.utc)}
}).sort("timestamp", 1)

# Get DataFrame - parallel fetch, cached for reuse
df = cursor.to_dataframe(
    chunking_granularity=timedelta(days=7),
    max_workers=8,
)

Key Features

Feature Description
🦀 GIL-Free Rust Backend Python's GIL is released. Rust's Tokio runtime handles async I/O across all cores.
Parallel MongoDB Fetching Queries split into time chunks. Each worker has its own MongoDB connection.
💾 Smart Query Cache Results cached by query hash. Filter cached data by date range.
🔀 DuckDB K-Way Merge GIL-free sorting across shards - O(N log K) complexity.
🐻‍❄️ Pandas & Polars to_dataframe() for pandas, to_polars() for Polars.
📊 Memory Control Set flush_ram_limit_mb to prevent OOM errors on large datasets.
📤 Stream to Data Lakes stream_to_callback() for S3/GCS ingestion pipelines.

Performance

Metric Improvement
Query Speed Up to 4x faster on large result sets
Compression 10-12x storage reduction with Parquet
Memory Configurable limits prevent OOM
Repeat Queries Instant from cache

Documentation

📖 Full documentation with architecture diagrams: GitHub Repository


License

Apache 2.0 - See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xlr8-0.1.6.tar.gz (138.8 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

xlr8-0.1.6-cp313-cp313-win_amd64.whl (7.2 MB view details)

Uploaded CPython 3.13Windows x86-64

xlr8-0.1.6-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.4 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

xlr8-0.1.6-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (8.1 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

xlr8-0.1.6-cp313-cp313-macosx_11_0_arm64.whl (7.4 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

xlr8-0.1.6-cp313-cp313-macosx_10_12_x86_64.whl (7.7 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

xlr8-0.1.6-cp312-cp312-win_amd64.whl (7.2 MB view details)

Uploaded CPython 3.12Windows x86-64

xlr8-0.1.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

xlr8-0.1.6-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (8.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

xlr8-0.1.6-cp312-cp312-macosx_11_0_arm64.whl (7.4 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

xlr8-0.1.6-cp312-cp312-macosx_10_12_x86_64.whl (7.7 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

xlr8-0.1.6-cp311-cp311-win_amd64.whl (7.2 MB view details)

Uploaded CPython 3.11Windows x86-64

xlr8-0.1.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.4 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

xlr8-0.1.6-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (8.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

xlr8-0.1.6-cp311-cp311-macosx_11_0_arm64.whl (7.4 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

xlr8-0.1.6-cp311-cp311-macosx_10_12_x86_64.whl (7.7 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

File details

Details for the file xlr8-0.1.6.tar.gz.

File metadata

  • Download URL: xlr8-0.1.6.tar.gz
  • Upload date:
  • Size: 138.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for xlr8-0.1.6.tar.gz
Algorithm Hash digest
SHA256 7d0094792203cbfa689683f2ec974d63533be4b48b4648e8bf7d62f23c50cca4
MD5 320060e9adcee40c61c422a14c8e26fd
BLAKE2b-256 790ea95d52c5f20a4e58f5772cff9163443c84353a75b35428231b06ebf5e6ad

See more details on using hashes here.

File details

Details for the file xlr8-0.1.6-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: xlr8-0.1.6-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 7.2 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for xlr8-0.1.6-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 4e702358cd543cf0ca4ab24110092af09e6aac82f9c0ff3417050022a1df70d1
MD5 a4c07eeac0f6f6405569812a2a7008e5
BLAKE2b-256 1e217f1ecb42d0bc0ca1e692b6c80358a651b6f3269a4e679c2de5e0960d13b2

See more details on using hashes here.

File details

Details for the file xlr8-0.1.6-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for xlr8-0.1.6-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 885e180593c7d8f332fbc53a3ef86be87028fe6445f49108a96354a9d31e7e5e
MD5 9771d15cbbacc0f3753ded5a1d767073
BLAKE2b-256 957a059c8f205efc8c9da83f1a66365dd0add0b79d6e7404f1f2f4977d87d98f

See more details on using hashes here.

File details

Details for the file xlr8-0.1.6-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for xlr8-0.1.6-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b2777b7eb1055e0f87a6888ecd807ca0605fafd70f498621536690c4432cbce2
MD5 8a96f345ba892a51978336aae5d0e4b4
BLAKE2b-256 58848766e9cf01daad7ae06e18fd48220fcefa0d8d96881e24e3d41e35b665e8

See more details on using hashes here.

File details

Details for the file xlr8-0.1.6-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for xlr8-0.1.6-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 795b27e23b195f182b6fb8123cf15366a98757eda15fa9f2d86349d649c40313
MD5 dda851843c52df600735a12a65d59a88
BLAKE2b-256 d590bfcebac424cbabe27547c07043fa66d8289c697a7bde91c9e67355652959

See more details on using hashes here.

File details

Details for the file xlr8-0.1.6-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for xlr8-0.1.6-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 94e44e728e665ae40c2ad4fca3741e55a2ef70ae78776c5a046fed8ff5fb1554
MD5 be265d3ed4eaca07cd9e9b06c59439b5
BLAKE2b-256 9982bc3c99585db5c390eef8027568b0c7d30e3a7702a540b35c44e5c666a0fe

See more details on using hashes here.

File details

Details for the file xlr8-0.1.6-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: xlr8-0.1.6-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 7.2 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for xlr8-0.1.6-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e174397753d09d81a41833568fc6866b99040ad7ce3cd815dac72c905b7b06cb
MD5 42cee77620309046f424ca4aa33631e7
BLAKE2b-256 a706e420b1233ee3d1519dc60a3a396049b8000b3c3715fb32f20dc18766a9e3

See more details on using hashes here.

File details

Details for the file xlr8-0.1.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for xlr8-0.1.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 755e3a99a6280da6531df72674b07461d106cd00548d52c65f320b88187815cd
MD5 1d629d2ff825b5a941ec23397a3c9a7b
BLAKE2b-256 bf4c0da25ee2d88ad6f013fb68f00a8eee40d36f0728e26490932d3ff4f12106

See more details on using hashes here.

File details

Details for the file xlr8-0.1.6-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for xlr8-0.1.6-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7480145525dec8b5e6453c996626c3e0a33884aa70f0c893826c108f0c05e3f0
MD5 613cb0e78c43780aeb7b88e9babf4162
BLAKE2b-256 156fd4e7945d0860eacb1fa47e6bd5ef7ba9ed4fe07f27550fc91c11c68847b3

See more details on using hashes here.

File details

Details for the file xlr8-0.1.6-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for xlr8-0.1.6-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d3a708f163f39139e73dcd4c5677a26553aa41e17e3016fd0b19e31a959c0ffd
MD5 8c0362cbcc1ac3ff46d09146a660e607
BLAKE2b-256 2ba211ee2953c11a7496d0e76664c35dd8b95462f19fd68a4f72aff9b5be8891

See more details on using hashes here.

File details

Details for the file xlr8-0.1.6-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for xlr8-0.1.6-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 10910770859e4a09322e0a1b6890b9f35ae89e80d2174bd4201d2b6a9866b288
MD5 815c339a8746ded6f63fa38d264d1815
BLAKE2b-256 f4a69e58c09c849f230b40a9521a4b889b1caa9d542c326e435fc301bab0a398

See more details on using hashes here.

File details

Details for the file xlr8-0.1.6-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: xlr8-0.1.6-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 7.2 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for xlr8-0.1.6-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 5564a3947d40c625358600d5656a4e3f19b56b773e551f1ead3502139cf1da8a
MD5 f3f508d2e407aca78b06aae4b6b94434
BLAKE2b-256 e31c054c3481a76e0eb342cedb3135323abb87cb95edadc3100d93f283a50f5c

See more details on using hashes here.

File details

Details for the file xlr8-0.1.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for xlr8-0.1.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fc5b22716faf935ac13fe82ef65a443938bb0f18230eaa1e43b7c45b85c1561a
MD5 b0fd6daeea6e0d4cd764db17155d143d
BLAKE2b-256 00937cb5e492973a594239d08e2eb20d734ad1e0d6fbafed620eb25dec7fb255

See more details on using hashes here.

File details

Details for the file xlr8-0.1.6-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for xlr8-0.1.6-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e852bbd7cfc95dcfe9e4dfef5f23bf097ec389b39ad860f11c2cb79852502edb
MD5 8ae90970450286761743a74b335a2652
BLAKE2b-256 3268e4d5cb95bf0c12f6bc510079d9251a4d6cffe2b9430ce587a0d9b47612ce

See more details on using hashes here.

File details

Details for the file xlr8-0.1.6-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for xlr8-0.1.6-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f6bb6952fed5f05ad2a67d13c9ea4ff5d7945618dcf8d211e1bf5ce2b3164e77
MD5 5227e72dd3a1697ecdca0ce2c7a82292
BLAKE2b-256 976c995028921c601b1524dbaf949b1c42be4fadc06c9c0ce27fb3b4fbdc8163

See more details on using hashes here.

File details

Details for the file xlr8-0.1.6-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for xlr8-0.1.6-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 bfc8d09924ab6333726bd1261bfe287d1c91728116b18cbbd7439ac8353731e7
MD5 b97f16a82dbac3aa1cd697654b84dd25
BLAKE2b-256 63d14c4410d65801fb0be54350a89a5021ca02af275233d88ad94e51393282a8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page