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: Return the table primary key.
  
  Copied from ``RedshiftSQLHook.get_table_primary_key()``
  
  :param table: Name of the target table
  :param database: the name of the database
  :param schema: Name of the target schema, public by default
  :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 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
  
  :return: Primary key columns list
docstr_tok: ["Return","the","table","primary","key",".","Copied","from","``","RedshiftSQLHook.get_table_primary_key","(",")","``",":","param","table",":","Name","of","the","target","table",":","param","database",":","the","name","of","the","database",":","param","schema",":","Name","of","the","target","schema",",","public","by","default",":","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","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",":","return",":","Primary","key","columns","list"]
code: def get_table_primary_key(
      self,
      table: str,
      database: str,
      schema: str | None = "public",
      cluster_identifier: str | None = None,
      workgroup_name: str | None = None,
      db_user: str | 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,
  ) -> list[str] | None:
      """
      Return the table primary key.
  
      Copied from ``RedshiftSQLHook.get_table_primary_key()``
  
      :param table: Name of the target table
      :param database: the name of the database
      :param schema: Name of the target schema, public by default
      :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 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
  
      :return: Primary key columns list
      """
      sql = f"""
              select kcu.column_name
              from information_schema.table_constraints tco
                      join information_schema.key_column_usage kcu
                          on kcu.constraint_name = tco.constraint_name
                              and kcu.constraint_schema = tco.constraint_schema
                              and kcu.constraint_name = tco.constraint_name
              where tco.constraint_type = 'PRIMARY KEY'
              and kcu.table_schema = {schema}
              and kcu.table_name = {table}
          """
      stmt_id = self.execute_query(
          sql=sql,
          database=database,
          cluster_identifier=cluster_identifier,
          workgroup_name=workgroup_name,
          db_user=db_user,
          secret_arn=secret_arn,
          statement_name=statement_name,
          with_event=with_event,
          wait_for_completion=wait_for_completion,
          poll_interval=poll_interval,
      )
      pk_columns = []
      token = ""
      while True:
          kwargs = {"Id": stmt_id}
          if token:
              kwargs["NextToken"] = token
          response = self.conn.get_statement_result(**kwargs)
          # we only select a single column (that is a string),
          # so safe to assume that there is only a single col in the record
          pk_columns += [
              y["stringValue"] for x in response["Records"] for y in x
          ]
          if "NextToken" in response:
              token = response["NextToken"]
          else:
              break
  
      return pk_columns or None
  
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 4 for calling the RedshiftDataHook obj's underlying member method code with example usage: obj.get_table_primary_key(table, database, schema, cluster_identifier, workgroup_name, db_user, secret_arn, statement_name, with_event, wait_for_completion, poll_interval) and returns: unknown