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.3.tar.gz (493.3 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.3-py3-none-any.whl (322.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: agora_etl-0.3.3.tar.gz
  • Upload date:
  • Size: 493.3 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.3.tar.gz
Algorithm Hash digest
SHA256 610a7266ab7f3e6df32e199d3111d3f94c37ed05e3d09f8aeb7e21a2095888f2
MD5 1c05d49f004c7554cf9a31b171607aba
BLAKE2b-256 a4e9906ca69c554841ee25078627478ab530da662e378f11dd9b380358bc527d

See more details on using hashes here.

Provenance

The following attestation bundles were made for agora_etl-0.3.3.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.3-py3-none-any.whl.

File metadata

  • Download URL: agora_etl-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 322.5 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 afd891d59dfbccb271ee77b68620e2205feb9f28bc725f6e4042d61b9443b7d7
MD5 5f7d2d2b37959151fb6d2fb1c937af74
BLAKE2b-256 ef6d1f2d8ae7fa607f4dd020427d8fdc40e514cd361438cf70538327a48d4249

See more details on using hashes here.

Provenance

The following attestation bundles were made for agora_etl-0.3.3-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