mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-25 09:28:23 +00:00
parent
ed58c27f76
commit
ef41382cb1
@ -6,14 +6,14 @@
|
|||||||
"testPlatforms": ["OpenMetadata", "GreatExpectations"],
|
"testPlatforms": ["OpenMetadata", "GreatExpectations"],
|
||||||
"parameterDefinition": [
|
"parameterDefinition": [
|
||||||
{
|
{
|
||||||
"name": "minColValue",
|
"name": "minValue",
|
||||||
"displayName": "minColValue",
|
"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",
|
"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"
|
"dataType": "INT"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "maxColValue",
|
"name": "maxValue",
|
||||||
"displayName": "maxColValue",
|
"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",
|
"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"
|
"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("TableColumnToMatchSet")(table_column_to_match_set)
|
||||||
validation_enum_registry.add("TableColumnNameToExist")(table_column_name_to_exist)
|
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
|
# # Column Tests
|
||||||
validation_enum_registry.add("columnValuesToBeBetween")(column_values_to_be_between)
|
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)],
|
testResultValue=[TestResultValue(name="resultRowCount", value=None)],
|
||||||
)
|
)
|
||||||
|
|
||||||
status = TestCaseStatus.Success if not rows else TestCaseStatus.Failed
|
if not rows:
|
||||||
result = f"Found {len(rows)} row(s). Test query is expected to return 0 row."
|
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(
|
return TestCaseResult(
|
||||||
timestamp=execution_date,
|
timestamp=execution_date,
|
||||||
testCaseStatus=status,
|
testCaseStatus=status,
|
||||||
result=result,
|
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,
|
test_case=test_case,
|
||||||
execution_date=EXECUTION_DATE.timestamp(),
|
execution_date=EXECUTION_DATE.timestamp(),
|
||||||
runner=self.runner,
|
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,
|
test_case=test_case,
|
||||||
execution_date=EXECUTION_DATE.timestamp(),
|
execution_date=EXECUTION_DATE.timestamp(),
|
||||||
runner=self.runner,
|
runner=self.runner,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user