Skip to main content

ingestio

Small, composable library for building data ingestion pipelines.

ingestio describes any data movement process as a sequence of steps. It does not assume your data is a table, that your architecture has bronze and silver layers, or that your processing is batch. Those are things you build with it, not things it imposes.

Status: early alpha (0.0.1). The core is functional and tested, the API is not stable yet.

Install

pip install ingestio

No runtime dependencies. An integration that needs one is an optional extra, such as pip install 'ingestio[postgres]'.

The idea

Three pieces, and the ordering is always yours:

Step a named point of the process; holds the callbacks that run there
Callback the code of one stage
Connector a reader or a writer, injected into the callback that needs it

Steps run in list order, and callbacks inside a step run in list order. There is no priority attribute and no hidden reordering: the sequence you write is the sequence that runs.

The library ships the engine, a few connectors (a JSON API reader, a JSON Lines writer, readers and writers for PostgreSQL and for files on disk) and two generic callbacks. The stages that are specific to your ingestion are yours to write — that is the point.

Design philosophy

Two concepts, and nothing else: connectors talk to external systems through the Reader and Writer protocols and decide nothing else, and callbacks are the stages that act on the data. The library composes rather than imposes: the smallest abstraction that works, no registries, and no dependencies in the core. The full text is in docs/philosophy.md.

Example: a public API into a volume

from ingestio import Process, ReadSource, Step, WriteTarget
from ingestio.connector.all import JsonApiReader, JsonLinesWriter

process = Process([
    Step("extract", [
        ReadSource(JsonApiReader("https://api.example.com/v1/orders")),
    ]),
    Step("load", [
        WriteTarget(JsonLinesWriter("/Volumes/main/bronze/orders.jsonl")),
    ]),
]).run()

print(len(process.state["records"]))

A Databricks volume is an ordinary path, so the same code runs on a laptop and on a cluster.

Writing a callback

A callback is a class with three optional moments. A step runs every before, then every run, then every after, so a callback gets a real boundary around the whole step while keeping list order within each pass.

Callbacks exchange data through process.state instead of passing a payload down a chain, so a callback that only observes does not have to hand the data back.

from datetime import UTC, datetime

from ingestio import Callback


class AddLineageColumns(Callback):
    """Stamp every record with where it came from and which run produced it."""

    def __init__(self, source: str, key: str = "records") -> None:
        self.source = source
        self.key = key

    def run(self) -> None:
        ingested_at = datetime.now(UTC).isoformat()
        self.process.state[self.key] = [
            {
                **record,
                "_ingested_at": ingested_at,
                "_source": self.source,
                "_batch_id": self.process.run_id,
            }
            for record in self.process.state[self.key]
        ]

Drop it into the step where it belongs:

Step("load", [
    AddLineageColumns(source="orders-api"),
    WriteTarget(JsonLinesWriter("/Volumes/main/bronze/orders.jsonl")),
])

The column names are yours. ingestio has no opinion about them.

Controlling failure

The library gives you the vocabulary; the policy is yours.

from ingestio import Callback, CancelProcessException


class SkipWhenEmpty(Callback):
    def run(self) -> None:
        if not self.process.state["records"]:
            raise CancelProcessException("nothing to ingest")
  • CancelStepException — skip the rest of this step, carry on with the next one.
  • CancelProcessException — stop the process cleanly.
  • anything else — propagates and kills the run, which is a legitimate choice you make by not catching it.

after runs in every case, so cleanup stays reliable.

Logging

Standard logging, never print, and every line carries the run id — so concurrent ingestions on the same cluster stay readable. A run logs as a tree: the process, each step, and every callback moment that ran, with its outcome and how long it took.

[a3f7c9] ┌ process started · 2 steps
[a3f7c9] │ ┌ extract (1/2) · 1 callback
[a3f7c9] │ │ ✔ ReadSource.run 412ms
[a3f7c9] │ └ extract done in 413ms
[a3f7c9] │ ┌ load (2/2) · 2 callbacks
[a3f7c9] │ │ ✔ AddLineageColumns.run 3ms
[a3f7c9] │ │ ✔ WriteTarget.run 15ms
[a3f7c9] │ └ load done in 19ms
[a3f7c9] └ process finished in 432ms

A failing callback gets a ✖ line at ERROR with the type and message of the exception, and the step and the process close as failed. The exception itself still propagates.

[a3f7c9] │ │ ✖ WriteTarget.run failed after 2ms: PermissionError: [Errno 13] Permission denied
[a3f7c9] │ └ load failed in 3ms
[a3f7c9] └ process failed in 415ms

Nothing shows until logging is configured. To see the tree on the console, opt in with one call:

from ingestio import log_to_console

log_to_console()  # stderr, colored on a terminal; NO_COLOR turns color off

It touches only the ingestio logger. A notebook is not a terminal: pass color=True when it renders ANSI colors. The full format is in docs/concepts/lifecycle.md.

Structuring a job

ingestio does not impose a layout on a job. A suggested minimum is two files:

orders_job/
├── config.json   the job's parameters
└── main.py       reads them, builds the process and runs it

config.json holds the parameters of the ingestion. The library never reads it: main.py does, and passes the values to the constructors of ingestio. Credentials never go in it.

{
  "table_name": "public.orders",
  "primary_key": "id",
  "watermark_column": "updated_at"
}

main.py imports ingestio, places the callbacks the library ships, defines the job's own and runs the process. This one copies the orders changed since the last run from the shop's database into the warehouse:

import json
import os
from datetime import datetime
from pathlib import Path

from ingestio import (
    Callback,
    CancelProcessException,
    Process,
    ReadSource,
    Step,
    WriteTarget,
    log_to_console,
)
from ingestio.connector.all import PostgresConnection, PostgresReader, PostgresWriter

config = json.loads(Path(__file__).with_name("config.json").read_text(encoding="utf-8"))

# Credentials come from the environment; on Databricks, from dbutils.secrets.get.
shop = PostgresConnection(
    "pg.internal", "shop", os.environ["SHOP_USER"], os.environ["SHOP_PASSWORD"]
)
warehouse = PostgresConnection(
    "dw.internal", "warehouse", os.environ["DW_USER"], os.environ["DW_PASSWORD"]
)


def last_watermark() -> datetime | None:
    """The highest `updated_at` already loaded, timezone-aware. None reads every row.

    Yours to write: query the warehouse, read a control table, ...
    """
    return None


class SkipEmptyBatch(Callback):
    """The job's own stage: stop cleanly when nothing changed since the last run."""

    def run(self) -> None:
        if self.process.state["records"].isEmpty():
            raise CancelProcessException("no new orders")


log_to_console()
Process([
    Step("extract", [
        ReadSource(PostgresReader(
            config["table_name"],
            shop,
            watermark_column=config["watermark_column"],
            watermark_value=last_watermark(),
        )),
    ]),
    Step("load", [
        SkipEmptyBatch(),
        WriteTarget(PostgresWriter(config["table_name"], warehouse)),
    ]),
]).run()
  • ReadSource and WriteTarget ship with the library; last_watermark and SkipEmptyBatch belong to the job. WriteTarget appends. A job that replaces the target writes a callback of its own that calls write(df, replace=True).
  • primary_key is in the configuration but not in the code. A connector takes only the parameters it uses, and neither PostgreSQL connector uses it (ADR 0013); it is there for the job's callbacks that do, such as a merge.
  • The writer gets config["table_name"] because the warehouse keeps the table's name. A job whose target has another name passes that name to the writer.

These two files are the whole job, and they run anywhere: in a container, as a Databricks job, on a laptop. The connectors built on Spark, such as the PostgreSQL and disk ones, expect a Spark session to be running already, and never start one. Databricks provides it; elsewhere, create it before the process runs, for example with SparkSession.builder.getOrCreate(). The rest of the library is plain Python. The PostgreSQL writer also needs the postgres extra; the requirements of each connector are in docs/concepts/connectors.md.

Roadmap

More connectors (object storage, Delta), and recipes — an optional declarative way to assemble a process, never a required one.

License

Apache-2.0

Metadata

Release files for ingestio 0.1.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 ingestio 0.1.0
File Size Uploaded Provenance
ingestio-0.1.0.tar.gz 214.2 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for ingestio 0.1.0
File Interpreter ABI Platform
ingestio-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 240.4 kB

Release files / ingestio-0.1.0.tar.gz

Download URL ingestio-0.1.0.tar.gz
Size 214.2 kB
Tags Source
SHA-256 checksum
How to use checksums
40484570f278e3b0cd9fc5fc4f913231328aab8986650c9eae8249a822453260
BLAKE2b-256 checksum
How to use checksums
ed2c3f032339d2570b9d5ae6da988f741340dc6f197d94c74b61fa0d5e47886a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Release files / ingestio-0.1.0-py3-none-any.whl

Download URL ingestio-0.1.0-py3-none-any.whl
Size 26.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7de0f7d24398d5c00c39e4630608aa2c72dcee64abd1656fae70b55d90244341
BLAKE2b-256 checksum
How to use checksums
145f40352aef3c1b133520bf9370ecce77de2cbf09f090de8a6ddfd19152d77e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Security for ingestio 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ingestio-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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