Skip to main content

airflow-serde-polars

License: Apache-2.0 github action PyPI version python version

how to install

pip install airflow-serde-polars

how to use

You don't need to call it specifically after installation. Serialization is done automatically when passing frames to XCOM.

example dag

from __future__ import annotations

from typing import TYPE_CHECKING

from pendulum import datetime

from airflow.decorators import dag, task

if TYPE_CHECKING:
    import polars as pl


@dag(start_date=datetime(2024, 1, 1), schedule=None, catchup=False)
def polars_sample():
    @task.python(do_xcom_push=True)
    def return_polars_frame() -> pl.DataFrame:
        import polars as pl

        return pl.DataFrame(
            {
                "a": [1, 2, 3],
                "b": [4, 5, 6],
            }
        )

    @task.python(do_xcom_push=False)
    def print_polars_frame(df: pl.DataFrame) -> None:
        from pprint import pprint

        pprint(df)

    frame = return_polars_frame()
    show = print_polars_frame(frame)  # pyright: ignore[reportArgumentType]

    _ = frame >> show


polars_sample()

Is this an airflow provider?

It's created for a similar purpose, but it's not a provider. The airflow providers meta information does not define a serializer.

When I am able to enter the provider meta information as a serializer, I will update the library to match the provider conditions.

Metadata

Release files for airflow-serde-polars 0.2.0

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

Source distribution (sdist)

Source distribution for airflow-serde-polars 0.2.0
File Size Uploaded
airflow_serde_polars-0.2.0.tar.gz 13.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for airflow-serde-polars 0.2.0
File Interpreter ABI Platform
airflow_serde_polars-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 25.2 kB

Release files / airflow_serde_polars-0.2.0.tar.gz

Download URL airflow_serde_polars-0.2.0.tar.gz
Size 13.3 kB
Tags Source
SHA-256 checksum
How to use checksums
9842894891aca3774c901495462db090b6c0be4c30e5e2e0fa30dc5fb0f29916
BLAKE2b-256 checksum
How to use checksums
f334aabfaf8a25272a09d2c9456f10bdd16d8327a666e4f8b4500164deb62922
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release files / airflow_serde_polars-0.2.0-py3-none-any.whl

Download URL airflow_serde_polars-0.2.0-py3-none-any.whl
Size 11.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a3c103425a34798cb652f093d4aa8c8fe7169df5735d761a7a6564834d1d6138
BLAKE2b-256 checksum
How to use checksums
626870eb088191de1fa149a3d5920a1853d703dea8eea8ff56df5e161099d20b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.1

2 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