mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-25 17:04:54 +00:00
chore(data-quality): improve messaging for COUNT strategy failure (#18884)
This commit is contained in:
parent
1140578b05
commit
416ba2c9cb
@ -37,7 +37,13 @@ class TableCustomSQLQueryValidator(BaseTableCustomSQLQueryValidator, SQAValidato
|
||||
text(sql_expression)
|
||||
)
|
||||
if strategy == Strategy.COUNT:
|
||||
return cursor.scalar()
|
||||
result = cursor.scalar()
|
||||
if not isinstance(result, int):
|
||||
raise ValueError(
|
||||
f"When using COUNT strategy, the result must be an integer. Received: {type(result)}\n"
|
||||
"Example: SELECT COUNT(*) FROM table_name WHERE my_value IS NOT NULL"
|
||||
)
|
||||
return result
|
||||
return cursor.fetchall()
|
||||
except Exception as exc:
|
||||
self.runner._session.rollback() # pylint: disable=protected-access
|
||||
|
Loading…
x
Reference in New Issue
Block a user