DescribeStatement - Amazon Redshift Data API

DescribeStatement

Describes the details about a specific instance when a query was run by the Amazon Redshift Data API. The information includes when the query started, when it finished, the query status, the number of rows returned, and the SQL statement.

Request Syntax

{ "Id": "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 to describe. This value is a universally unique identifier (UUID) generated by Amazon Redshift Data API. This identifier is returned by ExecuteStatment and ListStatements.

Type: String

Required: Yes

Response Syntax

{ "ClusterIdentifier": "string", "CreatedAt": number, "Database": "string", "DbUser": "string", "Duration": number, "Error": "string", "HasResultSet": boolean, "Id": "string", "QueryParameters": [ { "name": "string", "value": "string" } ], "QueryString": "string", "RedshiftPid": number, "RedshiftQueryId": number, "ResultRows": number, "ResultSize": number, "SecretArn": "string", "Status": "string", "UpdatedAt": 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.

Id

The identifier of the SQL statement described. This value is a universally unique identifier (UUID) generated by Amazon Redshift Data API.

Type: String

ClusterIdentifier

The cluster identifier.

Type: String

CreatedAt

The date and time (UTC) when the SQL statement was submitted to run.

Type: Timestamp

Database

The name of the database.

Type: String

DbUser

The database user name.

Type: String

Duration

The amount of time in nanoseconds that the statement ran.

Type: Long

Error

The error message from the cluster if the SQL statement encountered an error while running.

Type: String

HasResultSet

A value that indicates whether the statement has a result set. The result set can be empty.

Type: Boolean

QueryParameters

The parameters for the SQL statement.

Type: Array of SqlParameter objects

Array Members: Minimum number of 1 item.

QueryString

The SQL statement text.

Type: String

RedshiftPid

The process identifier from Amazon Redshift.

Type: Long

RedshiftQueryId

The identifier of the query generated by Amazon Redshift. These identifiers are also available in the query column of the STL_QUERY system view.

Type: Long

ResultRows

Either the number of rows returned from the SQL statement or the number of rows affected. If result size is greater than zero, the result rows can be the number of rows affected by SQL statements such as INSERT, UPDATE, DELETE, COPY, and others.

Type: Long

ResultSize

The size in bytes of the returned results.

Type: Long

SecretArn

The name or Amazon Resource Name (ARN) of the secret that enables access to the database.

Type: String

Status

The status of the SQL statement being described. Status values are defined as follows:

  • ABORTED - The query run was stopped by the user.

  • ALL - A status value that includes all query statuses. This value can be used to filter results.

  • FAILED - The query run failed.

  • FINISHED - The query has finished running.

  • PICKED - The query has been chosen to be run.

  • STARTED - The query run has started.

  • SUBMITTED - The query was submitted, but not yet processed.

Type: String

Valid Values: SUBMITTED | PICKED | STARTED | FINISHED | ABORTED | FAILED | ALL

UpdatedAt

The date and time (UTC) that the metadata for the SQL statement was last updated. An example is the time the status last changed.

Type: Timestamp

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 AWS SDKs, see the following: