class_docstr: Interact with Amazon Redshift Data API.
  
  Provide thin wrapper around
  :external+boto3:py:class:`boto3.client("redshift-data") <RedshiftDataAPIService.Client>`.
  
  Additional arguments (such as ``aws_conn_id``) may be specified and
  are passed down to the underlying AwsBaseHook.
  
  .. seealso::
      - :class:`airflow.providers.amazon.aws.hooks.base_aws.AwsBaseHook`
      - `Amazon Redshift Data API         <https://docs.aws.amazon.com/redshift-data/latest/APIReference/Welcome.html>`__
class_docstr_tok: ["Interact","with","Amazon","Redshift","Data","API",".","Provide","thin","wrapper","around",":","external+boto3",":","py",":","class",":","`","boto3.client","(","``","redshift-data","''",")","<","RedshiftDataAPIService.Client",">","`",".","Additional","arguments","(","such","as","``","aws_conn_id","``",")","may","be","specified","and","are","passed","down","to","the","underlying","AwsBaseHook",".","..","seealso",":",":","-",":","class",":","`","airflow.providers.amazon.aws.hooks.base_aws.AwsBaseHook","`","-","`","Amazon","Redshift","Data","API","<","https",":","\/\/docs.aws.amazon.com\/redshift-data\/latest\/APIReference\/Welcome.html",">","`","__"]
docstr: Execute a statement against Amazon Redshift.
  
  :param database: the name of the database
  :param sql: the SQL statement or list of  SQL statement to run
  :param cluster_identifier: unique identifier of a cluster
  :param db_user: the database username
  :param parameters: the parameters for the SQL statement
  :param secret_arn: the name or ARN of the secret that enables db access
  :param statement_name: the name of the SQL statement
  :param with_event: indicates whether to send an event to EventBridge
  :param wait_for_completion: indicates whether to wait for a result, if True wait, if False don't wait
  :param poll_interval: how often in seconds to check the query status
  :param workgroup_name: name of the Redshift Serverless workgroup. Mutually exclusive with
      `cluster_identifier`. Specify this parameter to query Redshift Serverless. More info
      https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-serverless.html
  
  :returns statement_id: str, the UUID of the statement
docstr_tok: ["Execute","a","statement","against","Amazon","Redshift",".",":","param","database",":","the","name","of","the","database",":","param","sql",":","the","SQL","statement","or","list","of","SQL","statement","to","run",":","param","cluster_identifier",":","unique","identifier","of","a","cluster",":","param","db_user",":","the","database","username",":","param","parameters",":","the","parameters","for","the","SQL","statement",":","param","secret_arn",":","the","name","or","ARN","of","the","secret","that","enables","db","access",":","param","statement_name",":","the","name","of","the","SQL","statement",":","param","with_event",":","indicates","whether","to","send","an","event","to","EventBridge",":","param","wait_for_completion",":","indicates","whether","to","wait","for","a","result",",","if","True","wait",",","if","False","do","n't","wait",":","param","poll_interval",":","how","often","in","seconds","to","check","the","query","status",":","param","workgroup_name",":","name","of","the","Redshift","Serverless","workgroup",".","Mutually","exclusive","with","`","cluster_identifier","`",".","Specify","this","parameter","to","query","Redshift","Serverless",".","More","info","https",":","\/\/docs.aws.amazon.com\/redshift\/latest\/mgmt\/working-with-serverless.html",":","returns","statement_id",":","str",",","the","UUID","of","the","statement"]
code: def execute_query(
      self,
      database: str,
      sql: str | list[str],
      cluster_identifier: str | None = None,
      db_user: str | None = None,
      parameters: Iterable | None = None,
      secret_arn: str | None = None,
      statement_name: str | None = None,
      with_event: bool = False,
      wait_for_completion: bool = True,
      poll_interval: int = 10,
      workgroup_name: str | None = None,
  ) -> str:
      """
      Execute a statement against Amazon Redshift.
  
      :param database: the name of the database
      :param sql: the SQL statement or list of  SQL statement to run
      :param cluster_identifier: unique identifier of a cluster
      :param db_user: the database username
      :param parameters: the parameters for the SQL statement
      :param secret_arn: the name or ARN of the secret that enables db access
      :param statement_name: the name of the SQL statement
      :param with_event: indicates whether to send an event to EventBridge
      :param wait_for_completion: indicates whether to wait for a result, if True wait, if False don't wait
      :param poll_interval: how often in seconds to check the query status
      :param workgroup_name: name of the Redshift Serverless workgroup. Mutually exclusive with
          `cluster_identifier`. Specify this parameter to query Redshift Serverless. More info
          https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-serverless.html
  
      :returns statement_id: str, the UUID of the statement
      """
      kwargs: dict[str, Any] = {
          "ClusterIdentifier": cluster_identifier,
          "Database": database,
          "DbUser": db_user,
          "Parameters": parameters,
          "WithEvent": with_event,
          "SecretArn": secret_arn,
          "StatementName": statement_name,
          "WorkgroupName": workgroup_name,
      }
      if isinstance(sql, list):
          kwargs["Sqls"] = sql
          resp = self.conn.batch_execute_statement(
              **trim_none_values(kwargs)
          )
      else:
          kwargs["Sql"] = sql
          resp = self.conn.execute_statement(**trim_none_values(kwargs))
  
      statement_id = resp["Id"]
  
      if bool(cluster_identifier) is bool(workgroup_name):
          raise ValueError(
              "Either 'cluster_identifier' or 'workgroup_name' must be specified."
          )
  
      if wait_for_completion:
          self.wait_for_results(
              statement_id, poll_interval=poll_interval
          )
  
      return statement_id
  
file_path: airflow/airflow/providers/amazon/aws/hooks/redshift_data.py
imports: from __future__ import annotations
  import time
  from pprint import pformat
  from typing import TYPE_CHECKING, Any, Iterable
  from airflow.providers.amazon.aws.hooks.base_aws import AwsGenericHook
  from airflow.providers.amazon.aws.utils import trim_none_values
label_desc: Use image node_id 2 for calling the RedshiftDataHook obj's underlying member method code with example usage: obj.execute_query(database, sql, cluster_identifier, db_user, parameters, secret_arn, statement_name, with_event, wait_for_completion, poll_interval, workgroup_name) and returns: statement_id