docstr: Executes the actual alert SQL query template
  
  :return: A pandas dataframe
  :raises AlertQueryError: SQL query is not valid
  :raises AlertQueryTimeout: The SQL query received a celery soft timeout
docstr_tok: ["Executes","the","actual","alert","SQL","query","template",":","return",":","A","pandas","dataframe",":","raises","AlertQueryError",":","SQL","query","is","not","valid",":","raises","AlertQueryTimeout",":","The","SQL","query","received","a","celery","soft","timeout"]
code: def _execute_query(self) -> pd.DataFrame:
      """
      Executes the actual alert SQL query template
  
      :return: A pandas dataframe
      :raises AlertQueryError: SQL query is not valid
      :raises AlertQueryTimeout: The SQL query received a celery soft timeout
      """
      sql_template = jinja_context.get_template_processor(
          database=self._report_schedule.database
      )
      rendered_sql = sql_template.process_template(
          self._report_schedule.sql
      )
      try:
          limited_rendered_sql = (
              self._report_schedule.database.apply_limit_to_sql(
                  rendered_sql, ALERT_SQL_LIMIT
              )
          )
  
          _, username = get_executor(
              executor_types=app.config["ALERT_REPORTS_EXECUTE_AS"],
              model=self._report_schedule,
          )
          user = security_manager.find_user(username)
          with override_user(user):
              start = default_timer()
              df = self._report_schedule.database.get_df(
                  sql=limited_rendered_sql
              )
              stop = default_timer()
              logger.info(
                  "Query for %s took %.2f ms",
                  self._report_schedule.name,
                  (stop - start) * 1000.0,
              )
              return df
      except SoftTimeLimitExceeded as ex:
          logger.warning(
              "A timeout occurred while executing the alert query: %s",
              ex,
          )
          raise AlertQueryTimeout() from ex
      except Exception as ex:
          raise AlertQueryError(message=str(ex)) from ex
  
imports: from __future__ import annotations
  import json
  import logging
  from operator import eq, ge, gt, le, lt, ne
  from timeit import default_timer
  from typing import Any
  import numpy
  import pandas
  from celery.exceptions import SoftTimeLimitExceeded
  from flask_babel import lazy_gettext
  from superset import app, jinja_context, security_manager
  from superset.commands.base import BaseCommand
  from superset.commands.report.exceptions import AlertQueryError, AlertQueryInvalidTypeError, AlertQueryMultipleColumnsError, AlertQueryMultipleRowsError, AlertQueryTimeout, AlertValidatorConfigError
  from superset.reports.models import ReportSchedule, ReportScheduleValidatorType
  from superset.tasks.utils import get_executor
  from superset.utils.core import override_user
  from superset.utils.retries import retry_call
label_desc: Use image node_id 8 for calling the AlertCommand obj's underlying member method code with example usage: obj._execute_query() and returns: df