Source code for loom.etl.observability.sinks._protocol
"""Persistence contracts for execution records."""
from __future__ import annotations
from collections.abc import Sequence
from typing import Any, Protocol
from loom.etl.declarative.expr._refs import TableRef
from loom.etl.observability.records import ExecutionRecord
[docs]
class ExecutionRecordStore(Protocol):
"""Protocol for persisting execution records."""
[docs]
def write_record(self, record: ExecutionRecord) -> None:
"""Persist one completed execution record."""
[docs]
class ExecutionRecordWriter(Protocol):
"""Persist one execution record into a table destination."""
[docs]
def write_record(self, record: ExecutionRecord, table_ref: TableRef, /) -> None:
"""Write *record* to *table_ref*."""
__all__ = ["ExecutionRecordStore", "ExecutionRecordWriter", "RecordFrameTargetWriter"]