Validation Checks API#
The validation checks module provides nine comprehensive check types for data quality validation.
LengthCheck#
- class wxdi.dq_validator.checks.length_check.LengthCheck(min_length: int | None = None, max_length: int | None = None)#
Bases:
BaseCheckValidates length of any value (converted to string) is within min/max bounds
Initialize length check
- Parameters:
- Raises:
ValueError – If parameters are invalid
ValidValuesCheck#
- class wxdi.dq_validator.checks.valid_values_check.ValidValuesCheck(valid_values: List[Any], case_sensitive: bool = False)#
Bases:
BaseCheckValidates value is in allowed list with optional case-insensitive comparison
Initialize valid values check
- Parameters:
- Raises:
ValueError – If valid_values is invalid
ComparisonCheck#
- class wxdi.dq_validator.checks.comparison_check.ComparisonCheck(operator: ComparisonOperator | str, target_column: str | None = None, target_value: Any | None = None)#
Bases:
BaseCheckValidates value comparison against another column or constant
Initialize comparison check
- Parameters:
- Raises:
ValueError – If parameters are invalid
Note: Exactly one of target_column or target_value must be provided
CaseCheck#
- class wxdi.dq_validator.checks.case_check.CaseCheck(case_type: ColumnCaseEnum = ColumnCaseEnum.ANY_CASE)#
Bases:
BaseCheckValidates that a string value follows a specific case rule
Initialize case check
- Parameters:
case_type (
ColumnCaseEnum, default:<ColumnCaseEnum.ANY_CASE: 'AnyCase'>) – Case type to enforce
- validate(value: Any, context: Dict[str, Any])#
Validate a value
- Parameters:
value (
Any) – The value to validatecontext (
Dict[str,Any]) – Additional context (e.g., other column values, metadata) Expected keys: - ‘column_name’: Name of the column being validated - ‘record’: The full record array (for column-to-column comparisons) - ‘metadata’: AssetMetadata object (for column lookups)
- Return type:
- Returns:
ValidationError if validation fails, None if passes
CompletenessCheck#
- class wxdi.dq_validator.checks.completeness_check.CompletenessCheck(missing_values_allowed: bool | None = False)#
Bases:
BaseCheckValidates that a value is not null unless missing values are allowed
Initialize completeness check
RangeCheck#
RegexCheck#
FormatCheck#
- class wxdi.dq_validator.checks.format_check.FormatCheck(constraint_type: FormatConstraintType | None = FormatConstraintType.ValidFormats, formats: Set[str] | None = None)#
Bases:
BaseCheckValidates if any value is of the format specified in the list of valid or invalid formats.
Initialize format check
- Parameters:
- validate(value: Any, context: Dict[str, Any])#
Validate a value
- Parameters:
value (
Any) – The value to validatecontext (
Dict[str,Any]) – Additional context (e.g., other column values, metadata) Expected keys: - ‘column_name’: Name of the column being validated - ‘record’: The full record array (for column-to-column comparisons) - ‘metadata’: AssetMetadata object (for column lookups)
- Return type:
- Returns:
ValidationError if validation fails, None if passes
DataTypeCheck#
- class wxdi.dq_validator.checks.datatype_check.DataTypeCheck(expected_type: DataType | None = None)#
Bases:
BaseCheckValidates a value to be of the same data type as that of the expected type
Initialize datatype check
- Parameters:
expected_type (
DataType|None, default:None) – Data type expected of the input value to pass the check
- validate(value: Any, context: Dict[str, Any])#
Validate a value
- Parameters:
value (
Any) – The value to validatecontext (
Dict[str,Any]) – Additional context (e.g., other column values, metadata) Expected keys: - ‘column_name’: Name of the column being validated - ‘record’: The full record array (for column-to-column comparisons) - ‘metadata’: AssetMetadata object (for column lookups)
- Return type:
- Returns:
ValidationError if validation fails, None if passes
Usage Examples#
See Validation Checks for detailed usage examples.