mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-24 08:58:06 +00:00
parent
ed58c27f76
commit
ef41382cb1
@ -6,14 +6,14 @@
|
||||
"testPlatforms": ["OpenMetadata", "GreatExpectations"],
|
||||
"parameterDefinition": [
|
||||
{
|
||||
"name": "minColValue",
|
||||
"displayName": "minColValue",
|
||||
"name": "minValue",
|
||||
"displayName": "minValue",
|
||||
"description": "Expected number of columns should be greater than or equal to {minValue}. If minValue is not included, maxValue is treated as upperBound and there will be no minimum number of column",
|
||||
"dataType": "INT"
|
||||
},
|
||||
{
|
||||
"name": "maxColValue",
|
||||
"displayName": "maxColValue",
|
||||
"name": "maxValue",
|
||||
"displayName": "maxValue",
|
||||
"description": "Expected number of columns should be less than or equal to {maxValue}. If maxValue is not included, minValue is treated as lowerBound and there will be no maximum number of column",
|
||||
"dataType": "INT"
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ validation_enum_registry.add("TableColumnCountToBeBetween")(
|
||||
)
|
||||
validation_enum_registry.add("TableColumnToMatchSet")(table_column_to_match_set)
|
||||
validation_enum_registry.add("TableColumnNameToExist")(table_column_name_to_exist)
|
||||
validation_enum_registry.add("TableCustomSQLQuery")(table_custom_sql_query)
|
||||
validation_enum_registry.add("tableCustomSQLQuery")(table_custom_sql_query)
|
||||
|
||||
# # Column Tests
|
||||
validation_enum_registry.add("columnValuesToBeBetween")(column_values_to_be_between)
|
||||
|
@ -72,12 +72,23 @@ def table_custom_sql_query(
|
||||
testResultValue=[TestResultValue(name="resultRowCount", value=None)],
|
||||
)
|
||||
|
||||
status = TestCaseStatus.Success if not rows else TestCaseStatus.Failed
|
||||
result = f"Found {len(rows)} row(s). Test query is expected to return 0 row."
|
||||
if not rows:
|
||||
status = TestCaseStatus.Success
|
||||
result_value = 0
|
||||
elif len(rows) == 1:
|
||||
status = TestCaseStatus.Success if rows[0].count == 0 else TestCaseStatus.Failed
|
||||
result_value = rows[0].count
|
||||
else:
|
||||
status = TestCaseStatus.Failed
|
||||
result_value = len(rows)
|
||||
|
||||
result = f"Found {result_value} row(s). Test query is expected to return 0 row."
|
||||
|
||||
return TestCaseResult(
|
||||
timestamp=execution_date,
|
||||
testCaseStatus=status,
|
||||
result=result,
|
||||
testResultValue=[TestResultValue(name="resultRowCount", value=str(len(rows)))],
|
||||
testResultValue=[
|
||||
TestResultValue(name="resultRowCount", value=str(result_value))
|
||||
],
|
||||
)
|
||||
|
@ -614,7 +614,7 @@ class testSuiteValidation(unittest.TestCase):
|
||||
],
|
||||
)
|
||||
|
||||
res = validation_enum_registry.registry["TableCustomSQLQuery"](
|
||||
res = validation_enum_registry.registry["tableCustomSQLQuery"](
|
||||
test_case=test_case,
|
||||
execution_date=EXECUTION_DATE.timestamp(),
|
||||
runner=self.runner,
|
||||
@ -636,7 +636,7 @@ class testSuiteValidation(unittest.TestCase):
|
||||
],
|
||||
)
|
||||
|
||||
res = validation_enum_registry.registry["TableCustomSQLQuery"](
|
||||
res = validation_enum_registry.registry["tableCustomSQLQuery"](
|
||||
test_case=test_case,
|
||||
execution_date=EXECUTION_DATE.timestamp(),
|
||||
runner=self.runner,
|
||||
|
Loading…
x
Reference in New Issue
Block a user