JasonD28 commented on a change in pull request #10605:
URL: 
https://github.com/apache/incubator-superset/pull/10605#discussion_r476764292



##########
File path: superset/tasks/schedules.py
##########
@@ -641,19 +650,44 @@ def deliver_slack_alert(alert_content: AlertContent, 
slack_channel: str) -> None
     )
 
 
-def run_alert_query(alert_id: int, label: str) -> None:
-    logger.info("Processing alert ID: %i", alert_id)
-    alert_observer = 
db.session.query(Observer).filter_by(alert_id=alert_id).one()
-
-    if not alert_observer:
+def query_alert_observer(alert_id: int, label: str) -> str:

Review comment:
       observe

##########
File path: superset/tasks/schedules.py
##########
@@ -641,19 +650,44 @@ def deliver_slack_alert(alert_content: AlertContent, 
slack_channel: str) -> None
     )
 
 
-def run_alert_query(alert_id: int, label: str) -> None:
-    logger.info("Processing alert ID: %i", alert_id)
-    alert_observer = 
db.session.query(Observer).filter_by(alert_id=alert_id).one()
-
-    if not alert_observer:
+def query_alert_observer(alert_id: int, label: str) -> str:
+    sql_observer = 
db.session.query(SQLObserver).filter_by(alert_id=alert_id).one()
+    if not sql_observer:
         logger.error("No observers present for alert <%s:%s>", alert_id, label)
 
+    parsed_query = ParsedQuery(sql_observer.sql)
+    sql = parsed_query.stripped()
+    df = sql_observer.database.get_df(sql)
+
+    if sql_observer.observation_value_type == 
SQLObservationValueType.sql_result:

Review comment:
       delete




----------------------------------------------------------------
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]

Reply via email to