code: def run(
      self,
  ) -> list[dict[str, Any]]:
      self.validate()
  
      sql = self._sql
      if self._template_params:
          template_processor = get_template_processor(self._database)
          sql = template_processor.process_template(
              sql, **self._template_params
          )
  
      timeout = SQLLAB_QUERY_COST_ESTIMATE_TIMEOUT
      timeout_msg = (
          f"The estimation exceeded the {timeout} seconds timeout."
      )
      try:
          with utils.timeout(
              seconds=timeout, error_message=timeout_msg
          ):
              cost = self._database.db_engine_spec.estimate_query_cost(
                  self._database,
                  self._schema,
                  sql,
                  utils.QuerySource.SQL_LAB,
              )
      except SupersetTimeoutException as ex:
          logger.exception(ex)
          raise SupersetErrorException(
              SupersetError(
                  message=__(
                      "The query estimation was killed after %(sqllab_timeout)s "
                      "seconds. It might be too complex, or the database might be "
                      "under heavy load.",
                      sqllab_timeout=SQLLAB_QUERY_COST_ESTIMATE_TIMEOUT,
                  ),
                  error_type=SupersetErrorType.SQLLAB_TIMEOUT_ERROR,
                  level=ErrorLevel.ERROR,
              ),
              status=500,
          ) from ex
  
      spec = self._database.db_engine_spec
      query_cost_formatters: dict[str, Any] = app.config[
          "QUERY_COST_FORMATTERS_BY_ENGINE"
      ]
      query_cost_formatter = query_cost_formatters.get(
          spec.engine, spec.query_cost_formatter
      )
      cost = query_cost_formatter(cost)
      return cost
  
file_path: superset/superset/commands/sql_lab/estimate.py
imports: from __future__ import annotations
  import logging
  from typing import Any
  from flask_babel import gettext
  from superset import app, db
  from superset.commands.base import BaseCommand
  from superset.errors import ErrorLevel, SupersetError, SupersetErrorType
  from superset.exceptions import SupersetErrorException, SupersetTimeoutException
  from superset.jinja_context import get_template_processor
  from superset.models.core import Database
  from superset.sqllab.schemas import EstimateQueryCostSchema
  from superset.utils import core
label_desc: Use image node_id 3 for calling the QueryEstimationCommand obj's underlying member method code with example usage: obj.run() and returns: cost