Apache Airflow serialization plugin using Polars
Project description
airflow-serde-polars
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9842894891aca3774c901495462db090b6c0be4c30e5e2e0fa30dc5fb0f29916 |
|
MD5 | 5438549b708088b4e3a0d9f6183dc68f |
|
BLAKE2b-256 | f334aabfaf8a25272a09d2c9456f10bdd16d8327a666e4f8b4500164deb62922 |
File details
Details for the file airflow_serde_polars-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: airflow_serde_polars-0.2.0-py3-none-any.whl
- Upload date:
- Size: 11.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3c103425a34798cb652f093d4aa8c8fe7169df5735d761a7a6564834d1d6138 |
|
MD5 | e1833abd803f070e1557f677b870f609 |
|
BLAKE2b-256 | 626870eb088191de1fa149a3d5920a1853d703dea8eea8ff56df5e161099d20b |