@dataclass
class MetricAndCheckResult:
level: str
check_description: str
constraint_message: str
metric_name: str
metric_instance: str
metric_entity: str
metric_value: float
status: str
constraint: str
@staticmethod
def _from_row(row: Row) -> "MetricAndCheckResult":
"""Create an instance from PySpark Row obejct."""
return MetricAndCheckResult(
level=row.level,
check_description=row.checkDescription,
constraint_message=row.constraintMessage,
metric_name=row.metricName,
metric_instance=row.metricInstance,
metric_entity=row.metricEntity,
metric_value=row.metricValue,
status=row.status,
constraint=row.constraint,
)