Calling the Data API - Amazon Redshift
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Calling the Data API

You can call the Data API or the Amazon CLI to run SQL statements on your cluster or serverless workgroup. The primary operations to run SQL statements are ExecuteStatement and BatchExecuteStatement in the Amazon Redshift Data API Reference. The Data API supports the programming languages that are supported by the Amazon SDK. For more information on these, see Tools to Build on Amazon.

To see code examples of calling the Data API, see Getting Started with Redshift Data API in GitHub. This repository has examples of using Amazon Lambda to access Amazon Redshift data from Amazon EC2, Amazon Glue Data Catalog, and Amazon SageMaker Runtime. Example programming languages include Python, Go, Java, and Javascript.

You can call the Data API using the Amazon CLI.

The following examples use the Amazon CLI to call the Data API. To run the examples, edit the parameter values to match your environment. In many of the examples a cluster-identifier is provided to run against a cluster. When you run against a serverless workgroup, you provide a workgroup-name instead. These examples demonstrate a few of the Data API operations. For more information, see the Amazon CLI Command Reference.

Commands in the following examples have been split and formatted for readability. Not all parameters and responses are shown in all examples. For the API definition of the complete request syntax, request parameters, response syntax, and response elements, see the Amazon Redshift Data API Reference.