mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-21 15:38:11 +00:00
Remove count logic in custom sql test as 1) create complex logic and 2) multiple users got confused with expected tests results (#8819)
This commit is contained in:
parent
1bae473ce8
commit
88c0ecb579
@ -75,9 +75,6 @@ def table_custom_sql_query(
|
||||
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)
|
||||
|
@ -225,9 +225,8 @@ parameterValues:
|
||||
```
|
||||
|
||||
### Table Custom SQL Test
|
||||
Write you own SQL test. The test will pass if either of the following condition is met:
|
||||
Write you own SQL test. The test will pass if the following condition is met:
|
||||
- The query result return 0 row
|
||||
- The query expression `COUNT(<col>)` returns 0
|
||||
|
||||
**Properties**
|
||||
|
||||
@ -236,15 +235,16 @@ Write you own SQL test. The test will pass if either of the following condition
|
||||
**Example**
|
||||
```sql
|
||||
SELECT
|
||||
COUNT(customer_tier)
|
||||
customer_id
|
||||
FROM DUAL
|
||||
WHERE customer_tier = 'GOLD' and lifetime_value < 10000;
|
||||
WHERE lifetime_value < 0;
|
||||
```
|
||||
|
||||
```sql
|
||||
SELECT
|
||||
customer_id
|
||||
FROM DUAL
|
||||
FROM DUAL d
|
||||
INNER JOIN OTHER o ON d.id = o.id
|
||||
WHERE lifetime_value < 0;
|
||||
```
|
||||
|
||||
@ -256,7 +256,7 @@ parameterValues:
|
||||
- name: sqlExpression
|
||||
value: >
|
||||
SELECT
|
||||
COUNT(customer_tier)
|
||||
customer_tier
|
||||
FROM DUAL
|
||||
WHERE customer_tier = 'GOLD' and lifetime_value < 10000;
|
||||
```
|
||||
@ -269,7 +269,7 @@ parameterValues:
|
||||
"parameterValues": [
|
||||
{
|
||||
"name": "sqlExpression",
|
||||
"value": "SELECT COUNT(customer_tier) FROM DUAL WHERE customer_tier = 'GOLD' and lifetime_value < 10000;\n"
|
||||
"value": "SELECT customer_tier FROM DUAL WHERE customer_tier = 'GOLD' and lifetime_value < 10000;"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user