JasonD28 commented on a change in pull request #10605:
URL:
https://github.com/apache/incubator-superset/pull/10605#discussion_r479895477
##########
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:
I believe having a test button on the form would require creating the
form from scratch, which would be outside the scope of this PR, so I will
remove the function and add a TODO.
----------------------------------------------------------------
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]