Amazon Redshift will no longer support the use of Python UDFs after June 30, 2026.
We will start enforcing it in phases. For more information on the details of Python end of life
and migration options, see the
blog post
Describe metadata about a SQL statement
To get descriptions of metadata for a SQL statement, use the aws
redshift-data describe-statement AWS CLI command. You can also use this
command to describe individual sub-statements within a batch by providing the
sub-statement ID. Authorization to run
this command is based on the caller's IAM permissions.
Optionally, to reduce the number of poll requests, use the WaitTimeSeconds parameter to give extra time for an operation's status to be updated within this API call. For more information, see Reduce API calls with long polling.
The following AWS CLI command describes a SQL statement.
aws redshift-data describe-statement --id d9b6c0c9-0747-4bf4-b142-e8883122f766
The following is an example of the response.
{ "ClusterIdentifier": "mycluster-test", "CreatedAt": 1598306924.632, "Duration": 1095981511, "Id": "d9b6c0c9-0747-4bf4-b142-e8883122f766", "QueryString": "select * from stl_query limit 1", "RedshiftPid": 20859, "RedshiftQueryId": 48879, "ResultRows": 1, "ResultSize": 4489, "Status": "FINISHED", "UpdatedAt": 1598306926.667 }
The following is an example of a describe-statement response after
running a batch-execute-statement command with multiple SQL
statements.
{ "ClusterIdentifier": "mayo", "CreatedAt": 1623979777.126, "Duration": 6591877, "HasResultSet": true, "Id": "b2906c76-fa6e-4cdf-8c5f-4de1ff9b7652", "RedshiftPid": 31459, "RedshiftQueryId": 0, "ResultRows": 2, "ResultSize": 22, "Status": "FINISHED", "SubStatements": [ { "CreatedAt": 1623979777.274, "Duration": 3396637, "HasResultSet": true, "Id": "b2906c76-fa6e-4cdf-8c5f-4de1ff9b7652:1", "QueryString": "select 1;", "RedshiftQueryId": -1, "ResultRows": 1, "ResultSize": 11, "Status": "FINISHED", "UpdatedAt": 1623979777.903 }, { "CreatedAt": 1623979777.274, "Duration": 3195240, "HasResultSet": true, "Id": "b2906c76-fa6e-4cdf-8c5f-4de1ff9b7652:2", "QueryString": "select 2;", "RedshiftQueryId": -1, "ResultRows": 1, "ResultSize": 11, "Status": "FINISHED", "UpdatedAt": 1623979778.076 } ], "UpdatedAt": 1623979778.183 }
The following AWS CLI command describes a specific sub-statement within a batch by providing the sub-statement ID.
aws redshift-data describe-statement --id b2906c76-fa6e-4cdf-8c5f-4de1ff9b7652:2
The following is an example of the response. The parent statement status
is STARTED because the batch has not yet completed. The
SubStatements array contains only the requested
sub-statement.
{ "ClusterIdentifier": "mayo", "CreatedAt": 1623979777.126, "Duration": 0, "HasResultSet": false, "Id": "b2906c76-fa6e-4cdf-8c5f-4de1ff9b7652", "RedshiftPid": 31459, "RedshiftQueryId": 0, "Status": "STARTED", "SubStatements": [ { "CreatedAt": 1623979777.274, "Duration": 3195240, "HasResultSet": true, "Id": "b2906c76-fa6e-4cdf-8c5f-4de1ff9b7652:2", "QueryString": "select 2;", "RedshiftQueryId": -1, "ResultRows": 1, "ResultSize": 11, "Status": "FINISHED", "UpdatedAt": 1623979778.076 } ], "UpdatedAt": 1623979777.503 }