Skip to main content

Apache Airflow serialization plugin using Polars

Project description

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.

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

airflow_serde_polars-0.2.0.tar.gz (13.3 kB view details)

Uploaded Source

Built Distribution

airflow_serde_polars-0.2.0-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file airflow_serde_polars-0.2.0.tar.gz.

File metadata

  • Download URL: airflow_serde_polars-0.2.0.tar.gz
  • Upload date:
  • Size: 13.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for airflow_serde_polars-0.2.0.tar.gz
Algorithm Hash digest
SHA256 9842894891aca3774c901495462db090b6c0be4c30e5e2e0fa30dc5fb0f29916
MD5 5438549b708088b4e3a0d9f6183dc68f
BLAKE2b-256 f334aabfaf8a25272a09d2c9456f10bdd16d8327a666e4f8b4500164deb62922

See more details on using hashes here.

File details

Details for the file airflow_serde_polars-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for airflow_serde_polars-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a3c103425a34798cb652f093d4aa8c8fe7169df5735d761a7a6564834d1d6138
MD5 e1833abd803f070e1557f677b870f609
BLAKE2b-256 626870eb088191de1fa149a3d5920a1853d703dea8eea8ff56df5e161099d20b

See more details on using hashes here.

Supported by

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