GetStatementResult - Amazon Redshift Data API
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).

GetStatementResult

Fetches the temporarily cached result of an SQL statement. A token is returned to page through the statement results.

For more information about the Amazon Redshift Data API and Amazon CLI usage examples, see Using the Amazon Redshift Data API in the Amazon Redshift Management Guide.

Request Syntax

{ "Id": "string", "NextToken": "string" }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.

Note

In the following list, the required parameters are described first.

Id

The identifier of the SQL statement whose results are to be fetched. This value is a universally unique identifier (UUID) generated by Amazon Redshift Data API. A suffix indicates then number of the SQL statement. For example, d9b6c0c9-0747-4bf4-b142-e8883122f766:2 has a suffix of :2 that indicates the second SQL statement of a batch query. This identifier is returned by BatchExecuteStatment, ExecuteStatment, and ListStatements.

Type: String

Pattern: ^[a-z0-9]{8}(-[a-z0-9]{4}){3}-[a-z0-9]{12}(:\d+)?$

Required: Yes

NextToken

A value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.

Type: String

Required: No

Response Syntax

{ "ColumnMetadata": [ { "columnDefault": "string", "isCaseSensitive": boolean, "isCurrency": boolean, "isSigned": boolean, "label": "string", "length": number, "name": "string", "nullable": number, "precision": number, "scale": number, "schemaName": "string", "tableName": "string", "typeName": "string" } ], "NextToken": "string", "Records": [ [ { ... } ] ], "TotalNumRows": number }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

Records

The results of the SQL statement.

Type: Array of arrays of Field objects

ColumnMetadata

The properties (metadata) of a column.

Type: Array of ColumnMetadata objects

NextToken

A value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.

Type: String

TotalNumRows

The total number of rows in the result set returned from a query. You can use this number to estimate the number of calls to the GetStatementResult operation needed to page through the results.

Type: Long

Errors

For information about the errors that are common to all actions, see Common Errors.

InternalServerException

The Amazon Redshift Data API operation failed due to invalid input.

HTTP Status Code: 500

ResourceNotFoundException

The Amazon Redshift Data API operation failed due to a missing resource.

HTTP Status Code: 400

ValidationException

The Amazon Redshift Data API operation failed due to invalid input.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific Amazon SDKs, see the following: