class_docstr: Run queries to generate statistics on alerts.
docstr: Transform Athena query results into alert counts for rules_engine
  
  Args:
      query (str): Athena query to run and wait for results
  
  Returns:
      dict: Representation of alert counts, where key is the rule name
          and value is the alert count (int) since this rule was staged
docstr_tok: ["Transform","Athena","query","results","into","alert","counts","for","rules_engine","Args",":","query","(","str",")",":","Athena","query","to","run","and","wait","for","results","Returns",":","dict",":","Representation","of","alert","counts",",","where","key","is","the","rule","name","and","value","is","the","alert","count","(","int",")","since","this","rule","was","staged"]
code: def _update_alert_count(self):
      """Transform Athena query results into alert counts for rules_engine
  
      Args:
          query (str): Athena query to run and wait for results
  
      Returns:
          dict: Representation of alert counts, where key is the rule name
              and value is the alert count (int) since this rule was staged
      """
      query = StagingStatistic.construct_compound_count_query(
          list(self._staging_stats.values())
      )
      LOGGER.debug(
          "Running compound query for alert count: '%s'", query
      )
      for page, results in enumerate(
          self._athena_client.query_result_paginator(query)
      ):
          for i, row in enumerate(results["ResultSet"]["Rows"]):
              if (
                  page == 0 and i == 0
              ):  # skip header row included in first page only
                  continue
  
              row_values = [
                  list(data.values())[0] for data in row["Data"]
              ]
              rule_name, alert_count = row_values[0], int(row_values[1])
  
              LOGGER.debug(
                  "Found %d alerts for rule '%s'",
                  alert_count,
                  rule_name,
              )
  
              self._staging_stats[rule_name].alert_count = alert_count
  
file_path: streamalert/streamalert/rule_promotion/promoter.py
imports: from datetime import datetime
  from streamalert.rule_promotion.publisher import StatsPublisher
  from streamalert.rule_promotion.statistic import StagingStatistic
  from streamalert.shared.utils import get_database_name
  from streamalert.shared.athena import AthenaClient
  from streamalert.shared.config import load_config
  from streamalert.shared.logger import get_logger
  from streamalert.shared.rule_table import RuleTable
label_desc: Use image node_id 3 for calling the RulePromoter obj's underlying member method code with example usage: obj._update_alert_count() without return types