bkyryliuk commented on a change in pull request #10605:
URL:
https://github.com/apache/incubator-superset/pull/10605#discussion_r479565235
##########
File path: superset/views/alerts.py
##########
@@ -23,17 +24,61 @@
from wtforms import BooleanField, Form, StringField
from superset.constants import RouteMethod
-from superset.models.alerts import Alert, AlertLog
+from superset.models.alerts import (
+ Alert,
+ AlertLog,
+ AlertValidatorType,
+ SQLObservation,
+ SQLObserver,
+ Validator,
+)
from superset.models.schedules import ScheduleType
from superset.tasks.schedules import schedule_alert_query
+from superset.utils import core as utils
from superset.utils.core import get_email_address_str, markdown
from ..exceptions import SupersetException
+from ..sql_parse import ParsedQuery
+from ..tasks.alerts.oberver import check_observer_result
from .base import SupersetModelView
# TODO: access control rules for this module
+def check_observer_sql(item: "SQLObserverInlineView") -> None:
+ try:
+ parsed_query = ParsedQuery(item.sql)
+ sql = parsed_query.stripped()
+ df = item.database.get_df(sql)
Review comment:
it may take up a lot of time, e.g. 10 min or so
let's have a test button instead that would run query & return the results
or avoid running the query
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]