Skip to content

aws.redshift_data.describe_statement

Example SQL Queries

SELECT * FROM
aws.redshift_data.describe_statement
WHERE
"id" = 'VALUE';

Description

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 CLI usage examples, see Using the Amazon Redshift Data API in the Amazon Redshift Management Guide.

Table Definition

Column NameColumn Data Type
id Required Input Column

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

VARCHAR
_aws_profile Input Column

The AWS profile defines the AWS identity used. It can be defined via credentials or by assuming a IAM role.

STRUCT(
"type" VARCHAR,
"name" VARCHAR,
"account_id" VARCHAR,
"via_profile_name" VARCHAR,
"assumed_role_arn" VARCHAR,
"organization" STRUCT(
"account_name" VARCHAR,
"id" VARCHAR,
"tags" STRUCT(
"key" VARCHAR,
"value" VARCHAR
)[],
"master_account" STRUCT(
"id" VARCHAR,
"email" VARCHAR
),
"parents" STRUCT(
"type" VARCHAR,
"id" VARCHAR,
"name" VARCHAR,
"tags" STRUCT(
"key" VARCHAR,
"value" VARCHAR
)[]
)[]
)
)
Show child fields
_aws_profile.account_id

The AWS account id

_aws_profile.assumed_role_arn

The ARN of the assumed role

_aws_profile.name

The unique name of the profile.

_aws_profile.organization

Information about this profile's membership in the AWS organization.

Show child fields
_aws_profile.organization.account_name

The name of account speciifed by the organization

_aws_profile.organization.id

The organization id

_aws_profile.organization.master_account
Show child fields
_aws_profile.organization.master_account.email

The organization master account email address

_aws_profile.organization.master_account.id

The organization master account id

_aws_profile.organization.parents[]
Show child fields
_aws_profile.organization.parents[].id

The id of the parent

_aws_profile.organization.parents[].name

The name of the parent

_aws_profile.organization.parents[].tags[]
Show child fields
_aws_profile.organization.parents[].tags[].key
_aws_profile.organization.parents[].tags[].value
_aws_profile.organization.parents[].type

The type of parent can be an organization unit or a root

_aws_profile.organization.tags[]
Show child fields
_aws_profile.organization.tags[].key
_aws_profile.organization.tags[].value
_aws_profile.type

The type of profile, either 'credentials' or 'assumed_role'

_aws_profile.via_profile_name

This IAM role for this profile is assumed by first utilizing another profile with this name to obtain credentials.

cluster_identifier

The cluster identifier.

VARCHAR
created_at

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

TIMESTAMP_S
database

The name of the database.

VARCHAR
db_user

The database user name.

VARCHAR
duration

The amount of time in nanoseconds that the statement ran.

BIGINT
error

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

VARCHAR
has_result_set

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.

BOOLEAN
query_parameters

The parameters for the SQL statement.

STRUCT(
"name" VARCHAR,
"value" VARCHAR
)[]
Show child fields
query_parameters[]
Show child fields
query_parameters[].name

The name of the parameter.

query_parameters[].value

The value of the parameter. Amazon Redshift implicitly converts to the proper data type. For more information, see Data types in the Amazon Redshift Database Developer Guide.

query_string

The SQL statement text.

VARCHAR
redshift_pid

The process identifier from Amazon Redshift.

BIGINT
redshift_query_id

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

BIGINT
result_rows

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.

BIGINT
result_size

The size in bytes of the returned results. A -1 indicates the value is null.

BIGINT
secret_arn

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

VARCHAR
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.

VARCHAR
sub_statements

The SQL statements from a multiple statement run.

STRUCT(
"created_at" TIMESTAMP_S,
"duration" BIGINT,
"error" VARCHAR,
"has_result_set" BOOLEAN,
"id" VARCHAR,
"query_string" VARCHAR,
"redshift_query_id" BIGINT,
"result_rows" BIGINT,
"result_size" BIGINT,
"status" VARCHAR,
"updated_at" TIMESTAMP_S
)[]
Show child fields
sub_statements[]
Show child fields
sub_statements[].created_at

The date and time (UTC) the statement was created.

sub_statements[].duration

The amount of time in nanoseconds that the statement ran.

sub_statements[].error

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

sub_statements[].has_result_set

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.

sub_statements[].id

The identifier of the SQL statement. 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.

sub_statements[].query_string

The SQL statement text.

sub_statements[].redshift_query_id

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

sub_statements[].result_rows

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.

sub_statements[].result_size

The size in bytes of the returned results. A -1 indicates the value is null.

sub_statements[].status

The status of the SQL statement. An example is the that the SQL statement finished.

sub_statements[].updated_at

The date and time (UTC) that the statement metadata was last updated.

updated_at

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

TIMESTAMP_S
workgroup_name

The serverless workgroup name or Amazon Resource Name (ARN).

VARCHAR