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.
For more information about the Amazon Redshift Data API and AWS CLI usage examples, see Using the Amazon Redshift Data API in the Amazon Redshift Management Guide.
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. A suffix indicates the 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 byBatchExecuteStatment
,ExecuteStatement
, andListStatements
.Type: String
Pattern:
^[a-z0-9]{8}(-[a-z0-9]{4}){3}-[a-z0-9]{12}(:\d+)?$
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,
"ResultFormat": "string",
"ResultRows": number,
"ResultSize": number,
"SecretArn": "string",
"SessionId": "string",
"Status": "string",
"SubStatements": [
{
"CreatedAt": number,
"Duration": number,
"Error": "string",
"HasResultSet": boolean,
"Id": "string",
"QueryString": "string",
"RedshiftQueryId": number,
"ResultRows": number,
"ResultSize": number,
"Status": "string",
"UpdatedAt": number
}
],
"UpdatedAt": number,
"WorkgroupName": "string"
}
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
Pattern:
^[a-z0-9]{8}(-[a-z0-9]{4}){3}-[a-z0-9]{12}(:\d+)?$
- 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. The value is true for an empty result set. The value is true if any substatement returns a result set.
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 theSTL_QUERY
system view.Type: Long
- ResultFormat
-
The data format of the result of the SQL statement.
Type: String
Valid Values:
JSON | CSV
- 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. A
-1
indicates the value is null.Type: Long
- ResultSize
-
The size in bytes of the returned results. A
-1
indicates the value is null.Type: Long
- SecretArn
-
The name or Amazon Resource Name (ARN) of the secret that enables access to the database.
Type: String
- SessionId
-
The session identifier of the query.
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
-
- SubStatements
-
The SQL statements from a multiple statement run.
Type: Array of SubStatementData objects
- 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
- WorkgroupName
-
The serverless workgroup name or Amazon Resource Name (ARN).
Type: String
Length Constraints: Minimum length of 3. Maximum length of 128.
Pattern:
^(([a-z0-9-]+)|(arn:(aws(-[a-z]+)*):redshift-serverless:[a-z]{2}(-gov)?-[a-z]+-\d{1}:\d{12}:workgroup/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}))$
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: