Skip to main content
polars-io-tools logo, an igloo made of blocks in different blue shades

Custom parsing extensions for lazy polars

Build Status codecov License PyPI

Overview

polars-io-tools extends Polars lazy execution with custom I/O sources that push filters and column projections all the way down into the systems that hold your data — SQL databases, ClickHouse, Datadog, and Delta Lake — instead of loading everything and filtering in memory. It also adds lazy-friendly operations (joins, multi-source composition, time-series windows, caching, distributed execution) that keep predicate pushdown working where vanilla Polars would otherwise give up and materialize the whole frame.

Everything is exposed through the piot LazyFrame namespace and a handful of top-level scan_* / sink_* functions, so it composes naturally with the Polars API you already use.

Who is this for

Reach for polars-io-tools when you want Polars' lazy API over data that lives in an external store, and you care about not fetching rows or columns you will immediately throw away. It is most valuable for large, partitioned, or remote datasets where a filter on a date or key column should translate into a smaller query against the source. If your data already fits comfortably in memory or lives in local Parquet/CSV, plain Polars is the simpler choice.

Installation

pip install polars-io-tools

polars-io-tools requires Python 3.11 or newer. See the Installation guide for conda and source builds.

Quickstart

Importing the package registers the piot namespace on every Polars LazyFrame:

import polars as pl
import polars_io_tools  # registers the .piot namespace

left = pl.LazyFrame({"x": [1, 2, 3], "y": [4, 5, 6]})
right = pl.LazyFrame({"x": [-1, -2, 3], "z": [7, 8, 9]})

# An inner join where the keys present on the left are pushed down as a
# filter on the right frame *before* the join runs.
result = left.piot.filtered_join(right, on="x").collect()
print(result)
# shape: (1, 3)
# ┌─────┬─────┬─────┐
# │ x   ┆ y   ┆ z   │
# │ --- ┆ --- ┆ --- │
# │ i64 ┆ i64 ┆ i64 │
# ╞═════╪═════╪═════╡
# │ 3   ┆ 6   ┆ 9   │
# └─────┴─────┴─────┘

For a guided walkthrough, start with the Getting Started tutorial.

What's included

  • Lazy I/O sources with predicate & projection pushdown — scan_db (any ODBC database), scan_clickhouse, scan_datadog, scan_delta, and from_narwhals. Filters on the resulting LazyFrame are translated into the source's own query language (SQL WHERE, Datadog time ranges, Delta partition pruning) so only the matching rows and columns are fetched.
  • Lazy writers — sink_delta and sink_clickhouse write a LazyFrame directly to Delta Lake or ClickHouse, including streaming/chunked writes and transparent handling of types the target store cannot represent natively.
  • Pushdown-preserving query building — filtered_join, filtered_join_asof, join_between, pushdown_combine, concat_named, and ts_with_columns express joins, multi-source composition, and rolling/lookback time-series logic without blocking the filter pushdown that those operations normally defeat.
  • Caching — cache keeps an in-memory, column- and partition-level cache for iterative work; cache_parquet materializes date-partitioned Parquet on local disk or S3, fetching only the partitions a query needs.
  • Distributed execution — execute_on_ray splits a LazyFrame across an existing Ray cluster, one task per partition. Build partitions with by_time (calendar windows), by_value (discrete keys), by_range (numeric buckets), by_key (enumerated keys), or an explicit ReadPartition list. (For multi-stage distributed pipelines, Polars Cloud is the more strategic option.)
  • Ergonomics — iter_rows for memory-efficient row iteration, debug to inspect what Polars pushes into a source, and disable_optimizations to compare against plain Polars.

Documentation

Full documentation lives in the project wiki:

Contributing

Contributions are welcome. See the Contributing guide and Local Development Setup to get started.

License

polars-io-tools is licensed under the Apache 2.0 license.

Release files for polars-io-tools 0.2.2

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-io-tools 0.2.2
File Size Uploaded
polars_io_tools-0.2.2.tar.gz 598.6 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for polars-io-tools 0.2.2
File
polars_io_tools-0.2.2-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details
polars_io_tools-0.2.2-cp311-abi3-manylinux_2_28_x86_64.whl CPython 3.11 abi3 Linux glibc 2.28+ x86-64 Details
polars_io_tools-0.2.2-cp311-abi3-manylinux_2_28_aarch64.whl CPython 3.11 abi3 Linux glibc 2.28+ ARM64 Details
polars_io_tools-0.2.2-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details

Total release size: 3.1 MB

Release files / polars_io_tools-0.2.2.tar.gz

Download URL polars_io_tools-0.2.2.tar.gz
Size 598.6 kB
Tags Source
SHA-256 checksum
How to use checksums
49452212a7c71cffaf3b48508f80e5db8a4a49a6c880940bfe89c719ee02e437
BLAKE2b-256 checksum
How to use checksums
0ecd8dbdd932d0eb89f350f9591587a0889f3a4982291000acb8ea76d18ebc80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Release files / polars_io_tools-0.2.2-cp311-abi3-win_amd64.whl

Download URL polars_io_tools-0.2.2-cp311-abi3-win_amd64.whl
Size 539.1 kB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
ed77755aeccfc863450aa7f78a5e5cbd99453081de047877bd440cd41d4650e9
BLAKE2b-256 checksum
How to use checksums
6ebebaf10f7382565200ac695e3bb9a4266bb1d4556a495ac323c14e08c9dff6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Release files / polars_io_tools-0.2.2-cp311-abi3-manylinux_2_28_x86_64.whl

Download URL polars_io_tools-0.2.2-cp311-abi3-manylinux_2_28_x86_64.whl
Size 654.8 kB
Tags CPython 3.11 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
de3223e553336a28450905c8d839dfbd54ac193a5e4c6f604d6805c0f4483dc9
BLAKE2b-256 checksum
How to use checksums
0ff24538990a9db37310b5208b17e6622ae410ca3898d297d31e1ffbcb9a252b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Release files / polars_io_tools-0.2.2-cp311-abi3-manylinux_2_28_aarch64.whl

Download URL polars_io_tools-0.2.2-cp311-abi3-manylinux_2_28_aarch64.whl
Size 654.1 kB
Tags CPython 3.11 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
41ec5a591db24af730f562005596f47f43a1f50fa2302683c9e5a12ff0f8699c
BLAKE2b-256 checksum
How to use checksums
7f1f81a62a0c2b61bcc7b44bf42a9c6ebdbb0d791f7440b286b83742927e4bca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Release files / polars_io_tools-0.2.2-cp311-abi3-macosx_11_0_arm64.whl

Download URL polars_io_tools-0.2.2-cp311-abi3-macosx_11_0_arm64.whl
Size 631.9 kB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
95182eb36e9a503b1445e6dd7892a6b2a97699e70f4660603a4b5978caa9fbd2
BLAKE2b-256 checksum
How to use checksums
9d8a1a8b64065c1738f39eccb6735378449399c9f2f176811b7bce767915912a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Release history Release notifications | RSS feed

0.2.4

4 release files

0.2.3

5 release files

This release

0.2.2 This release

5 release files

0.2.1

5 release files

0.2.0

5 release files

0.1.2

4 release files

0.1.1

4 release files

0.1.0

4 release files

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