docstr: Cancel query in the underlying database.
  
  :param cursor: New cursor instance to the db of the query
  :param query: Query instance
  :param cancel_query_id: MySQL Connection ID
  :return: True if query cancelled successfully, False otherwise
docstr_tok: ["Cancel","query","in","the","underlying","database",".",":","param","cursor",":","New","cursor","instance","to","the","db","of","the","query",":","param","query",":","Query","instance",":","param","cancel_query_id",":","MySQL","Connection","ID",":","return",":","True","if","query","cancelled","successfully",",","False","otherwise"]
code: def cancel_query(
      cls, cursor: Any, query: Query, cancel_query_id: str
  ) -> bool:
      """
      Cancel query in the underlying database.
  
      :param cursor: New cursor instance to the db of the query
      :param query: Query instance
      :param cancel_query_id: MySQL Connection ID
      :return: True if query cancelled successfully, False otherwise
      """
      try:
          cursor.execute(f"KILL CONNECTION {cancel_query_id}")
      except Exception:  # pylint: disable=broad-except
          return False
  
      return True
  
imports: import contextlib
  import re
  from datetime import datetime
  from decimal import Decimal
  from re import Pattern
  from typing import Any, Callable, Optional
  from urllib import parse
  from flask_babel import gettext
  from sqlalchemy import types
  from sqlalchemy.dialects.mysql import BIT, DECIMAL, DOUBLE, FLOAT, INTEGER, LONGTEXT, MEDIUMINT, MEDIUMTEXT, TINYINT, TINYTEXT
  from sqlalchemy.engine.url import URL
  from superset.constants import TimeGrain
  from superset.db_engine_specs.base import BaseEngineSpec, BasicParametersMixin
  from superset.errors import SupersetErrorType
  from superset.models.sql_lab import Query
  from superset.utils.core import GenericDataType
label_desc: Use image node_id 8 for calling the MySQLEngineSpec obj's underlying member method code with example usage: obj.cancel_query(cls, cursor, query, cancel_query_id) and returns: True, False