Skip to content

Exceptions

loadx.exceptions

SCD2Error

Bases: Exception

Base exception class for SCD2 processing errors.

Source code in loadx/exceptions.py
4
5
6
7
8
9
class SCD2Error(Exception):
    """Base exception class for SCD2 processing errors."""

    def __init__(self, message: str) -> None:
        super().__init__(message)
        self.message = message

OldDataExceptionError

Bases: SCD2Error

Exception raised when source data is older than target data.

Source code in loadx/exceptions.py
12
13
14
15
16
17
18
19
20
21
22
23
24
class OldDataExceptionError(SCD2Error):
    """Exception raised when source data is older than target data."""

    def __init__(
        self, src_date: str | None = None, tgt_date: str | None = None
    ) -> None:
        if src_date and tgt_date:
            message = f"Source data ({src_date}) is older than target data ({tgt_date})"
        else:
            message = "Data is older than last target load date"
        super().__init__(message)
        self.src_date = src_date
        self.tgt_date = tgt_date

EmptyDataExceptionError

Bases: SCD2Error

Exception raised when source DataFrame is empty.

Source code in loadx/exceptions.py
27
28
29
30
31
class EmptyDataExceptionError(SCD2Error):
    """Exception raised when source DataFrame is empty."""

    def __init__(self) -> None:
        super().__init__("Empty dataframe, exiting scd2 load")

BusinessKeysEmptyError

Bases: ValueError, SCD2Error

Exception raised when business keys are empty or not provided.

Source code in loadx/exceptions.py
34
35
36
37
38
class BusinessKeysEmptyError(ValueError, SCD2Error):
    """Exception raised when business keys are empty or not provided."""

    def __init__(self) -> None:
        super().__init__("business_keys cannot be empty")

ConfigurationError

Bases: SCD2Error

Exception raised when SCD2 configuration is invalid.

Source code in loadx/exceptions.py
41
42
43
44
45
class ConfigurationError(SCD2Error):
    """Exception raised when SCD2 configuration is invalid."""

    def __init__(self, message: str) -> None:
        super().__init__(f"Configuration error: {message}")

DataValidationError

Bases: SCD2Error

Exception raised when data validation fails.

Source code in loadx/exceptions.py
48
49
50
51
52
class DataValidationError(SCD2Error):
    """Exception raised when data validation fails."""

    def __init__(self, message: str) -> None:
        super().__init__(f"Data validation error: {message}")