Source code for loom.etl.declarative.target._history._enums
"""Historify domain enums for SCD Type 2 targets."""
from __future__ import annotations
from enum import StrEnum
[docs]
class DeletePolicy(StrEnum):
"""Action applied to entity keys absent from an incoming snapshot.
Only meaningful when ``mode=SNAPSHOT``; LOG mode ignores this setting.
Values:
* ``IGNORE`` — leave open vectors open. Use for partial or incremental
snapshots where absence does not imply deletion.
* ``CLOSE`` — close the open vector by setting
``valid_to = effective_date - 1``. Standard SCD2 behavior for full-dimension
snapshots.
* ``SOFT_DELETE`` — close the open vector and stamp a ``deleted_at`` column.
Use when downstream systems require explicit deletion audit trails.
"""
IGNORE = "ignore"
CLOSE = "close"
SOFT_DELETE = "soft_delete"
[docs]
class HistoryDateType(StrEnum):
"""Column type used for ``valid_from`` / ``valid_to`` boundary columns.
Values:
* ``DATE`` — calendar date precision. Suitable for daily SCD2 pipelines.
* ``TIMESTAMP`` — microsecond precision. Use for event-driven or sub-daily
update patterns.
"""
DATE = "date"
TIMESTAMP = "timestamp"
__all__ = ["HistorifyInputMode", "DeletePolicy", "HistoryDateType"]