Skip to main content

Agora — async-first ETL framework for Python.

Project description

Agora ETL Framework

Async-first ETL framework for Python.

License Python PyPI

agora-etl is the core Agora runtime: a builder-first ETL framework organized around Source -> Middleware chain -> Sink(s).

It stays focused on runtime semantics and extension contracts:

  • immutable pipeline composition
  • per-record, batched, and Arrow-aware execution
  • checkpointing and replay
  • DLQ and sink failure policies
  • backpressure, tracing, metrics, and health surfaces
  • scheduled workers and config-driven runs

Official backend integrations such as Redis, Kafka, PostgreSQL, cron scheduling, and distributed coordination live in agora-etl-plugins. Optional acceleration belongs in agora-etl-rs.

Install

pip install agora-etl
pip install "agora-etl[file]"          # pyarrow + faster JSONL paths
pip install "agora-etl-plugins[all]"   # official first-party integrations

Quick Start

import asyncio

from agora import DeliveryConfig, IterableSource, Pipeline
from agora.core.dlq import SQLiteDLQSink
from agora.sinks.file.jsonlines import JsonLinesSink

records = [
    {"id": 1, "city": "Ho Chi Minh City", "confidence": 0.92},
    {"id": 2, "city": "Da Nang",          "confidence": 0.41},
    {"id": 3, "city": "Hanoi",            "confidence": 0.88},
]


async def main() -> None:
    summary = await (
        Pipeline(IterableSource(records))
        .filter(lambda row: row["confidence"] >= 0.5, name="confidence_gate")
        .build(
            JsonLinesSink(path="cities.jsonl"),
            config=DeliveryConfig(
                dlq=SQLiteDLQSink(".agora_dlq.db"),
                batch_size=100,
            ),
        )
        .run()
    )
    print(summary)


asyncio.run(main())

What this does:

  • reads from an in-memory source
  • filters low-confidence rows
  • writes the survivors to cities.jsonl
  • sends failed records to a local SQLite DLQ
  • returns a PipelineRunSummary with counts, timing, and runtime signals

Why 0.3.0 Matters

Agora now exposes execution shape as a first-class contract.

Three shared data planes:

  • python_rows
  • python_batches
  • arrow_batches

That vocabulary now shows up consistently across sources, middleware, writer planning, sink boundaries, runtime summaries, and tracing.

You can inspect the plan before the run starts:

from agora import Pipeline
from agora.sinks.file.csv import CsvSink

bound = Pipeline(source).build(CsvSink(path="out.csv", row_mapper=lambda row: row))

plan = bound.explain(max_records=1_000)
print(plan)
print(plan.to_dict())

PipelineExplain surfaces:

  • selected execution lane
  • source and writer data planes
  • middleware compatibility matrix
  • per-sink selected plane and downgrade markers

Execution Shapes

Agora supports more than one runtime shape, but keeps them explicit:

  • row pipelines: standard Middleware / MapMiddleware / FilterMiddleware
  • Python batch pipelines: stream_batches() plus BatchMiddleware
  • Arrow pipelines: pyarrow.RecordBatch plus Arrow-native middleware and sinks

The important rule is that one middleware chain must stay internally compatible:

  • Python-row chain is valid
  • all-Arrow chain is valid
  • mixed Arrow plus Python-row/list-batch chain is rejected during planning

For Arrow fan-out, Agora chooses the best path per sink:

  • Arrow-capable sinks receive the original RecordBatch
  • non-Arrow sinks downgrade only at the sink boundary

Builder Model

The pipeline builder is immutable.

base = (
    Pipeline(source)
    .pipe(NormalizeMiddleware())
    .filter(lambda row: row["confidence"] >= 0.5)
)

csv_pipeline = base.build(CsvSink(path="clean.csv", row_mapper=lambda row: row))
jsonl_pipeline = base.build(JsonLinesSink(path="clean.jsonl"))

Common composition patterns:

  • .build(sink) for one destination
  • .fan_out([...]) for writing the same record to many sinks
  • .route(router) for sending each record to one matching sink
  • .run(max_records=N) for bounded runs, now enforced at the source boundary

Delivery options are passed via DeliveryConfig, including:

  • dlq
  • checkpoint
  • batch_size
  • sink_failure_policy
  • sink_concurrency
  • backpressure
  • tracer

Public Data-Plane API

The execution-shape contract is now public API:

from agora import DataPlane, SinkDataPlaneSpec, SourceDataPlaneSpec
source_spec = source.data_plane_spec()
sink_spec = sink.data_plane_spec()

Legacy data-plane booleans still work in 0.3.x, but they are now a compatibility bridge and emit DeprecationWarning when Agora has to infer a non-row plane from them.

Preferred direction:

  • sources override data_plane_spec()
  • sinks advertise accepted_data_planes and native_data_planes

Core vs Plugins

Keep this mental model:

  • agora-etl: runtime semantics, pipeline contracts, CLI, docs
  • agora-etl-plugins: official integrations
  • agora-etl-rs: optional acceleration that preserves the same semantics

If a capability depends on Redis, Kafka, PostgreSQL, cron parsing, or distributed lease ownership, it likely belongs in the plugin bundle rather than the core package.

Documentation Map

Reference sections:

License

Apache 2.0 - see LICENSE.

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

agora_etl-0.3.1.tar.gz (455.6 kB view details)

Uploaded Source

Built Distribution

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

agora_etl-0.3.1-py3-none-any.whl (285.8 kB view details)

Uploaded Python 3

File details

Details for the file agora_etl-0.3.1.tar.gz.

File metadata

  • Download URL: agora_etl-0.3.1.tar.gz
  • Upload date:
  • Size: 455.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for agora_etl-0.3.1.tar.gz
Algorithm Hash digest
SHA256 6c1bc5dc7b95bd187102e7da76fe1add2119f11376a155ca145e65aa03912992
MD5 a5839d82a9c45dc4f43340259c45b6dd
BLAKE2b-256 cbe030963b3b66792eef3f31473c4e0ec5ecc883ac8d20e439ca4db21ee5ba25

See more details on using hashes here.

Provenance

The following attestation bundles were made for agora_etl-0.3.1.tar.gz:

Publisher: release.yml on thanhtham010891/agora-etl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agora_etl-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: agora_etl-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 285.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for agora_etl-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a38cb6a986f79f0e53d0de18887ca25f057d29d174353a592335184ea1154f7a
MD5 025188512d63d4f1f4b7387d4bb2bf07
BLAKE2b-256 8275b42a555ba68ded61179b79476e40b9ee26a6f8d1faccf05ac49e2970ec13

See more details on using hashes here.

Provenance

The following attestation bundles were made for agora_etl-0.3.1-py3-none-any.whl:

Publisher: release.yml on thanhtham010891/agora-etl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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