Skip to content

_is_closed_partition

Internal helper
This page documents an internal implementation helper, not a primary public API.
Source code in src/fabricops_kit/drift.py
988
989
990
991
992
993
994
995
996
997
998
999
def _is_closed_partition(partition_value: Any, grace_days: int) -> bool:
    if grace_days == 0:
        return True
    try:
        parsed = datetime.fromisoformat(str(partition_value)).date()
    except ValueError:
        try:
            parsed = date.fromisoformat(str(partition_value))
        except ValueError:
            return True
    cutoff = datetime.now(timezone.utc).date() - timedelta(days=grace_days)
    return parsed < cutoff