Transformations¶
Transformations are the heart of ETLantic.
A transformation defines how data logically changes as it moves through a pipeline. Like FastAPI endpoints, transformations are declared using Python classes and type annotations. The declaration describes the interface; execution implementations remain separate.
ETLantic models transformations using Transformation Contracts, represented portably by the Data Transformation Contract Standard (DTCS).
What This Section Covers¶
This section explains how to:
- Define transformations using Python classes
- Declare typed inputs and outputs
- Define transformation parameters
- Register execution implementations
- Support synchronous and asynchronous execution
- Generate DTCS artifacts
- Validate transformation compatibility
- Connect transformations into pipelines
The Authoring Model¶
A transformation begins as a typed class:
from etlantic import Input, Output, Parameter, Transformation
class NormalizeCustomers(Transformation):
customers: Input[RawCustomer]
minimum_age: Parameter[int] = 18
result: Output[Customer]
This declaration answers:
- What data enters?
- What data leaves?
- What configuration controls behavior?
It intentionally does not answer how the work is performed.
An Available 0.11 surface adds a PySpark-inspired, implementation-agnostic
definition that serializes as a DTCS 3.0 Transformation Plan. Plugins that
compile those plans are sequenced for 0.12–0.15. See
Portable Transformations. Authoring is available
in ETLantic 0.11; use @implementation(...) for runtime until compilers ship.
Separating Interface from Implementation¶
Execution is registered independently.
A second implementation may target another backend:
Both satisfy the same transformation contract.
Relationship to DTCS¶
DTCS is the portable representation of a transformation.
The Python class is the preferred authoring surface.
The DTCS document is the portable artifact.
Relationship to Pipelines¶
Transformations are connected together inside pipelines.
ETLantic validates that upstream outputs satisfy downstream inputs before execution planning begins.
Sync and Async¶
ETLantic supports both synchronous and asynchronous implementations.
The framework normalizes invocation internally so authors focus on business logic rather than concurrency.
Callbacks¶
Transformations may expose lifecycle callbacks for events such as:
- Invalid input data
- Invalid output data
- Execution failures
- Retry decisions
- Completion notifications
Callbacks may be synchronous or asynchronous.
Validation¶
ETLantic validates:
- Input compatibility
- Output compatibility
- Parameter types
- Implementation signatures
- Plugin capabilities
DTCS defines transformation semantics; ETLantic coordinates validation.
Generated Artifacts¶
A transformation can generate:
- DTCS contracts
- Documentation
- Mermaid diagrams
- Graphviz diagrams
- API metadata
- Planning metadata
These artifacts are deterministic and suitable for version control.
Documentation Roadmap¶
Read this section in the following order:
TRANSFORMATION.mdINPUTS.mdOUTPUTS.mdPARAMETERS.mdTYPE_ANNOTATIONS.mdIMPLEMENTATIONS.mdPORTABLE_TRANSFORMATIONS.md(accepted 0.11+ authoring design)PORTABLE_FUNCTIONS.md(DTCS 2.0/3.0 mapping for the planned facade)CALLBACKS.mdERROR_HANDLING.mdASYNC.mdDTCS.md
Key Principles¶
- Transformations define interfaces, not execution.
- Types are the source of truth.
- Implementations are interchangeable.
- DTCS is the canonical portable representation.
- Python remains the preferred authoring experience.
- Execution belongs to plugins.
Next Step¶
Continue with Transformation to learn how to define transformation contracts using typed Python classes.