2025-04-03 10:39:47 +05:30
|
|
|
# Copyright 2025 Collate
|
|
|
|
|
# Licensed under the Collate Community License, Version 1.0 (the "License");
|
2023-02-22 09:42:34 +01:00
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
|
# You may obtain a copy of the License at
|
2025-04-03 10:39:47 +05:30
|
|
|
# https://github.com/open-metadata/OpenMetadata/blob/main/ingestion/LICENSE
|
2023-02-22 09:42:34 +01:00
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
|
# limitations under the License.
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
Validator for column value missing count to be equal test case
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
from typing import Optional
|
|
|
|
|
|
2023-04-04 17:16:44 +02:00
|
|
|
from metadata.data_quality.validations.column.base.columnValuesMissingCount import (
|
2023-02-22 09:42:34 +01:00
|
|
|
BaseColumnValuesMissingCountValidator,
|
|
|
|
|
)
|
2023-04-04 17:16:44 +02:00
|
|
|
from metadata.data_quality.validations.mixins.pandas_validator_mixin import (
|
2023-02-22 09:42:34 +01:00
|
|
|
PandasValidatorMixin,
|
|
|
|
|
)
|
2023-04-04 17:16:44 +02:00
|
|
|
from metadata.profiler.metrics.registry import Metrics
|
2023-02-22 09:42:34 +01:00
|
|
|
from metadata.utils.sqa_like_column import SQALikeColumn
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ColumnValuesMissingCountValidator(
|
|
|
|
|
BaseColumnValuesMissingCountValidator, PandasValidatorMixin
|
|
|
|
|
):
|
|
|
|
|
"""Validator for column value missing count to be equal test case"""
|
|
|
|
|
|
|
|
|
|
def _run_results(
|
|
|
|
|
self, metric: Metrics, column: SQALikeColumn, **kwargs
|
|
|
|
|
) -> Optional[int]:
|
|
|
|
|
"""compute result of the test case
|
|
|
|
|
|
|
|
|
|
Args:
|
|
|
|
|
metric: metric
|
|
|
|
|
column: column
|
|
|
|
|
"""
|
|
|
|
|
return self.run_dataframe_results(self.runner, metric, column, **kwargs)
|