loom.etl.runtime¶
Runtime contracts used by executor and backend implementations.
- class loom.etl.runtime.TableDiscovery(*args, **kwargs)[source]¶
Bases:
ProtocolProtocol for catalog-backed table existence and schema discovery.
Used by
ETLCompilerwhen a catalog is injected at construction time to validate that source and target tables are valid before execution begins.- schema(ref)[source]¶
Return full table schema.
- Parameters:
ref (TableRef) – Logical table reference.
- Returns:
Ordered column schema tuple, or
Nonewhen table is missing.- Return type:
tuple[ColumnSchema, …] | None
- update_schema(ref, schema)[source]¶
Persist table schema after a successful write.
- Parameters:
ref (TableRef) – Logical table reference.
schema (tuple[ColumnSchema, ...]) – Authoritative table schema.
- Return type:
None
- class loom.etl.runtime.SourceReader(*args, **kwargs)[source]¶
Bases:
ProtocolProtocol for reading one ETL source specification into a frame.
- read(spec, params_instance, /)[source]¶
Read the source and return a frame.
- Parameters:
spec (TableSourceSpec | FileSourceSpec | TempSourceSpec) – Compiled source specification.
params_instance (Any) – Concrete params for current run.
- Returns:
Backend frame type accepted by the step
execute()method.- Return type:
- class loom.etl.runtime.SQLExecutor(*args, **kwargs)[source]¶
Bases:
ProtocolOptional capability protocol for SQL execution over source frames.
- class loom.etl.runtime.TargetWriter(*args, **kwargs)[source]¶
Bases:
ProtocolProtocol for writing one frame into one ETL target specification.
- write(frame, spec, params_instance, /, *, streaming=False)[source]¶
Write frame to target.
- Parameters:
frame (Any) – Frame returned by step
execute().spec (AppendSpec | ReplaceSpec | ReplacePartitionsSpec | ReplaceWhereSpec | UpsertSpec | HistorifySpec | FileSpec | TempSpec | TempFanInSpec) – Compiled target specification.
params_instance (Any) – Concrete params for current run.
streaming (bool) – Hint for lazy backends to use streaming materialization.
- Return type:
None