Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GEN-970] feat(data-quality): support multiple runtime parameter types #18588

Merged
merged 5 commits into from
Nov 21, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
implemented removesuffix
sushi30 committed Nov 13, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit cbfc0842b8b1e0b5b73fd652163d1da43da2f63f
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@
This class is responsible for creating instances of the RuntimeParameterSetter
based on the test case.
"""

import sys
from typing import Dict, Set, Type

from metadata.data_quality.validations.runtime_param_setter.param_setter import (
@@ -30,10 +30,27 @@
from metadata.profiler.processor.sampler.sqlalchemy.sampler import SQASampler


def removesuffix(s: str, suffix: str) -> str:
"""A custom implementation of removesuffix for python versions < 3.9

Args:
s (str): The string to remove the suffix from
suffix (str): The suffix to remove

Returns:
str: The string with the suffix removed
"""
if sys.version_info >= (3, 9):
return s.removesuffix(suffix)
if s.endswith(suffix):
return s[: -len(suffix)]
return s


def validator_name(test_case_class: Type) -> str:
return (
test_case_class.__name__[0].lower() + test_case_class.__name__[1:]
).removesuffix("Validator")
return removesuffix(
test_case_class.__name__[0].lower() + test_case_class.__name__[1:], "Validator"
)


class RuntimeParameterSetterFactory: