2026/07/23 - Redshift Data API Service - 1 new 5 updated api methods
Changes This release include long polling provids a new parameter wait-time-seconds to 5 API operations, new API ListSessions, and a new parameter execution-mode to BatchExecuteStatement
Lists the sessions that the caller created in the last 24 hours. By default, only sessions with a status of AVAILABLE or BUSY are returned. You can filter the results by session status, compute target (cluster or serverless workgroup), or database. To retrieve the metadata for a single session, provide the SessionId parameter. Use NextToken to page through the session list.
Returns only the sessions that the caller created. When identity-enhanced role sessions are used, you must provide either the ClusterIdentifier or WorkgroupName parameter to ensure that the AWS IAM Identity Center user can only access the Amazon Redshift IAM Identity Center applications they are assigned. For more information, see Trusted identity propagation overview.
See also: AWS API Documentation
Request Syntax
client.list_sessions(
NextToken='string',
MaxResults=123,
SessionId='string',
Status='AVAILABLE'|'BUSY'|'CLOSED',
RoleLevel=True|False,
ClusterIdentifier='string',
WorkgroupName='string',
Database='string'
)
string
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.
integer
The maximum number of sessions to return in the response. If more sessions exist than fit in one response, the operation returns NextToken to paginate the results.
string
The identifier of a specific session to return metadata for. This value is a universally unique identifier (UUID) generated by Amazon Redshift Data API. When you provide SessionId, you can't specify Status, ClusterIdentifier, WorkgroupName, or Database.
string
The status of the sessions to list. If no status is specified, sessions with a status of AVAILABLE or BUSY are returned. Status values are defined as follows:
AVAILABLE – The session is open and ready to run a SQL statement.
BUSY – The session is currently running a SQL statement.
CLOSED – The session is closed and can no longer run SQL statements.
boolean
Specifies whether to return all sessions created by the caller's IAM role, including sessions from previous IAM sessions. If false, only sessions created in the current IAM session are returned. The default is true.
string
The cluster identifier. Only sessions on this cluster are returned. When providing ClusterIdentifier, then WorkgroupName can't be specified.
string
The serverless workgroup name or Amazon Resource Name (ARN). Only sessions on this workgroup are returned. When providing WorkgroupName, then ClusterIdentifier can't be specified.
string
The name of the database. Only sessions connected to this database are returned.
dict
Response Syntax
{
'Sessions': [
{
'SessionId': 'string',
'Status': 'AVAILABLE'|'BUSY'|'CLOSED',
'CreatedAt': datetime(2015, 1, 1),
'UpdatedAt': datetime(2015, 1, 1),
'Database': 'string',
'DbUser': 'string',
'ClusterIdentifier': 'string',
'WorkgroupName': 'string',
'SessionAliveSeconds': 123,
'SessionTtl': datetime(2015, 1, 1),
'CurrentStatementId': 'string'
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
Sessions (list) --
The sessions that match the request.
(dict) --
Contains the metadata for a session returned by ListSessions, including its status, compute target, database connection, and lifecycle timestamps.
SessionId (string) --
The session identifier. This value is a universally unique identifier (UUID) generated by Amazon Redshift Data API.
Status (string) --
The status of the session. Status values are defined as follows:
AVAILABLE – The session is open and ready to run a SQL statement.
BUSY – The session is currently running a SQL statement.
CLOSED – The session is closed and can no longer run SQL statements.
CreatedAt (datetime) --
The date and time (UTC) when the session was created.
UpdatedAt (datetime) --
The date and time (UTC) that the session metadata was last updated. An example is the time the status last changed.
Database (string) --
The name of the database that the session is connected to.
DbUser (string) --
The database user name.
ClusterIdentifier (string) --
The cluster identifier. This element is not returned when connecting to a serverless workgroup.
WorkgroupName (string) --
The serverless workgroup name or Amazon Resource Name (ARN). This element is not returned when connecting to a provisioned cluster.
SessionAliveSeconds (integer) --
The number of seconds that the session is kept alive after a query finishes.
SessionTtl (datetime) --
The date and time (UTC) when the session is set to expire and be closed.
CurrentStatementId (string) --
The identifier of the SQL statement currently running in the session. This value is a universally unique identifier (UUID) generated by Amazon Redshift Data API. This element is returned only when the session status is BUSY.
NextToken (string) --
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.
{'ExecutionMode': 'TRANSACTION | AUTO_COMMIT', 'WaitTimeSeconds': 'integer'}
Response {'HasResultSet': 'boolean',
'RedshiftPid': 'long',
'Status': 'SUBMITTED | PICKED | STARTED | FINISHED | ABORTED | FAILED'}
Runs one or more SQL statements, which can be data manipulation language (DML) or data definition language (DDL). Depending on the authorization method, use one of the following combinations of request parameters:
Secrets Manager - when connecting to a cluster, provide the secret-arn of a secret stored in Secrets Manager which has username and password. The specified secret contains credentials to connect to the database you specify. When you are connecting to a cluster, you also supply the database name, If you provide a cluster identifier ( dbClusterIdentifier), it must match the cluster identifier stored in the secret. When you are connecting to a serverless workgroup, you also supply the database name.
Temporary credentials - when connecting to your data warehouse, choose one of the following options:
When connecting to a serverless workgroup, specify the workgroup name and database name. The database user name is derived from the IAM identity. For example, arn:iam::123456789012:user:foo has the database user name IAM:foo. Also, permission to call the redshift-serverless:GetCredentials operation is required.
When connecting to a cluster as an IAM identity, specify the cluster identifier and the database name. The database user name is derived from the IAM identity. For example, arn:iam::123456789012:user:foo has the database user name IAM:foo. Also, permission to call the redshift:GetClusterCredentialsWithIAM operation is required.
When connecting to a cluster as a database user, specify the cluster identifier, the database name, and the database user name. Also, permission to call the redshift:GetClusterCredentials operation is required.
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.
See also: AWS API Documentation
Request Syntax
client.batch_execute_statement(
Sqls=[
'string',
],
ClusterIdentifier='string',
SecretArn='string',
DbUser='string',
Database='string',
WithEvent=True|False,
StatementName='string',
Parameters=[
{
'name': 'string',
'value': 'string'
},
],
WorkgroupName='string',
ClientToken='string',
ResultFormat='JSON'|'CSV',
SessionKeepAliveSeconds=123,
SessionId='string',
ExecutionMode='TRANSACTION'|'AUTO_COMMIT',
WaitTimeSeconds=123
)
list
[REQUIRED]
One or more SQL statements to run. The SQL statements run serially in the order of the array. Subsequent SQL statements don't start until the previous statement in the array completes. By default, the SQL statements are run as a single transaction. If any SQL statement fails, all work is rolled back. To change this behavior, see the ExecutionMode parameter.
(string) --
string
The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.
string
The name or ARN of the secret that enables access to the database. This parameter is required when authenticating using Secrets Manager.
string
The database user name. This parameter is required when connecting to a cluster as a database user and authenticating using temporary credentials.
string
The name of the database. This parameter is required when authenticating using either Secrets Manager or temporary credentials.
boolean
A value that indicates whether to send an event to the Amazon EventBridge event bus after the SQL statements run.
string
The name of the SQL statements. You can name the SQL statements when you create them to identify the query.
list
The parameters for the SQL statements. The parameters are available to all SQL statements in the batch. Each statement can reference any subset of the provided parameters. Each provided parameter must be referenced by at least one SQL statement in the batch.
(dict) --
A parameter used in a SQL statement.
name (string) -- [REQUIRED]
The name of the parameter.
value (string) -- [REQUIRED]
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.
string
The serverless workgroup name or Amazon Resource Name (ARN). This parameter is required when connecting to a serverless workgroup and authenticating using either Secrets Manager or temporary credentials.
string
A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.
This field is autopopulated if not provided.
string
The data format of the result of the SQL statement. If no format is specified, the default is JSON.
integer
The number of seconds to keep the session alive after the query finishes. The maximum time a session can keep alive is 24 hours. After 24 hours, the session is forced closed and the query is terminated.
string
The session identifier of the query.
string
Determines how the SQL statements in the batch are run. If set to TRANSACTION (the default), all SQL statements are run as a single transaction and they are committed or rolled back together. If set to AUTO_COMMIT, each SQL statement is committed individually, and a failure of one statement does not affect the others.
integer
The number of seconds to wait for all SQL statements in the batch to complete execution before returning the response. If the SQL statements do not complete within the specified time, the response returns the current status. The maximum value is 30 seconds.
dict
Response Syntax
{
'Id': 'string',
'CreatedAt': datetime(2015, 1, 1),
'ClusterIdentifier': 'string',
'DbUser': 'string',
'DbGroups': [
'string',
],
'Database': 'string',
'SecretArn': 'string',
'WorkgroupName': 'string',
'SessionId': 'string',
'Status': 'SUBMITTED'|'PICKED'|'STARTED'|'FINISHED'|'ABORTED'|'FAILED',
'RedshiftPid': 123,
'HasResultSet': True|False
}
Response Structure
(dict) --
Id (string) --
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. This identifier is returned by BatchExecuteStatment.
CreatedAt (datetime) --
The date and time (UTC) the statement was created.
ClusterIdentifier (string) --
The cluster identifier. This element is not returned when connecting to a serverless workgroup.
DbUser (string) --
The database user name.
DbGroups (list) --
A list of colon (:) separated names of database groups.
(string) --
Database (string) --
The name of the database.
SecretArn (string) --
The name or ARN of the secret that enables access to the database.
WorkgroupName (string) --
The serverless workgroup name or Amazon Resource Name (ARN). This element is not returned when connecting to a provisioned cluster.
SessionId (string) --
The session identifier of the query.
Status (string) --
The status of the SQL statement. Status values are defined as follows:
ABORTED - The query run was stopped by the user.
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.
RedshiftPid (integer) --
The process identifier from Amazon Redshift.
HasResultSet (boolean) --
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.
{'WaitTimeSeconds': 'integer'}
Response {'ExecutionMode': 'TRANSACTION | AUTO_COMMIT'}
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.
See also: AWS API Documentation
Request Syntax
client.describe_statement(
Id='string',
WaitTimeSeconds=123
)
string
[REQUIRED]
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 by BatchExecuteStatment, ExecuteStatement, and ListStatements.
integer
The number of seconds to wait for the SQL statement to complete execution before returning the description. The maximum value is 30 seconds.
dict
Response Syntax
{
'Id': 'string',
'SecretArn': 'string',
'DbUser': 'string',
'Database': 'string',
'ClusterIdentifier': 'string',
'Duration': 123,
'Error': 'string',
'Status': 'SUBMITTED'|'PICKED'|'STARTED'|'FINISHED'|'ABORTED'|'FAILED'|'ALL',
'CreatedAt': datetime(2015, 1, 1),
'UpdatedAt': datetime(2015, 1, 1),
'RedshiftPid': 123,
'HasResultSet': True|False,
'QueryString': 'string',
'ResultRows': 123,
'ResultSize': 123,
'RedshiftQueryId': 123,
'QueryParameters': [
{
'name': 'string',
'value': 'string'
},
],
'SubStatements': [
{
'Id': 'string',
'Duration': 123,
'Error': 'string',
'Status': 'SUBMITTED'|'PICKED'|'STARTED'|'FINISHED'|'ABORTED'|'FAILED',
'CreatedAt': datetime(2015, 1, 1),
'UpdatedAt': datetime(2015, 1, 1),
'QueryString': 'string',
'ResultRows': 123,
'ResultSize': 123,
'RedshiftQueryId': 123,
'HasResultSet': True|False
},
],
'WorkgroupName': 'string',
'ResultFormat': 'JSON'|'CSV',
'SessionId': 'string',
'ExecutionMode': 'TRANSACTION'|'AUTO_COMMIT'
}
Response Structure
(dict) --
Id (string) --
The identifier of the SQL statement described. This value is a universally unique identifier (UUID) generated by Amazon Redshift Data API.
SecretArn (string) --
The name or Amazon Resource Name (ARN) of the secret that enables access to the database.
DbUser (string) --
The database user name.
Database (string) --
The name of the database.
ClusterIdentifier (string) --
The cluster identifier.
Duration (integer) --
The amount of time in nanoseconds that the statement ran.
Error (string) --
The error message from the cluster if the SQL statement encountered an error while running.
Status (string) --
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.
CreatedAt (datetime) --
The date and time (UTC) when the SQL statement was submitted to run.
UpdatedAt (datetime) --
The date and time (UTC) that the metadata for the SQL statement was last updated. An example is the time the status last changed.
RedshiftPid (integer) --
The process identifier from Amazon Redshift.
HasResultSet (boolean) --
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.
QueryString (string) --
The SQL statement text.
ResultRows (integer) --
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.
ResultSize (integer) --
The size in bytes of the returned results. A -1 indicates the value is null.
RedshiftQueryId (integer) --
The identifier of the query generated by Amazon Redshift. These identifiers are also available in the query column of the STL_QUERY system view.
QueryParameters (list) --
The parameters for the SQL statement.
(dict) --
A parameter used in a SQL statement.
name (string) --
The name of the parameter.
value (string) --
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.
SubStatements (list) --
The SQL statements from a multiple statement run.
(dict) --
Information about an SQL statement.
Id (string) --
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.
Duration (integer) --
The amount of time in nanoseconds that the statement ran.
Error (string) --
The error message from the cluster if the SQL statement encountered an error while running.
Status (string) --
The status of the SQL statement. An example is the that the SQL statement finished.
CreatedAt (datetime) --
The date and time (UTC) the statement was created.
UpdatedAt (datetime) --
The date and time (UTC) that the statement metadata was last updated.
QueryString (string) --
The SQL statement text.
ResultRows (integer) --
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.
ResultSize (integer) --
The size in bytes of the returned results. A -1 indicates the value is null.
RedshiftQueryId (integer) --
The SQL statement identifier. This value is a universally unique identifier (UUID) generated by Amazon Redshift Data API.
HasResultSet (boolean) --
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.
WorkgroupName (string) --
The serverless workgroup name or Amazon Resource Name (ARN).
ResultFormat (string) --
The data format of the result of the SQL statement.
SessionId (string) --
The session identifier of the query.
ExecutionMode (string) --
The execution mode of the batch request. TRANSACTION indicates all SQL statements are run as a single transaction. AUTO_COMMIT indicates each SQL statement is committed individually.
{'WaitTimeSeconds': 'integer'}
Response {'HasResultSet': 'boolean',
'RedshiftPid': 'long',
'Status': 'SUBMITTED | PICKED | STARTED | FINISHED | ABORTED | FAILED'}
Runs an SQL statement, which can be data manipulation language (DML) or data definition language (DDL). This statement must be a single SQL statement. Depending on the authorization method, use one of the following combinations of request parameters:
Secrets Manager - when connecting to a cluster, provide the secret-arn of a secret stored in Secrets Manager which has username and password. The specified secret contains credentials to connect to the database you specify. When you are connecting to a cluster, you also supply the database name, If you provide a cluster identifier ( dbClusterIdentifier), it must match the cluster identifier stored in the secret. When you are connecting to a serverless workgroup, you also supply the database name.
Temporary credentials - when connecting to your data warehouse, choose one of the following options:
When connecting to a serverless workgroup, specify the workgroup name and database name. The database user name is derived from the IAM identity. For example, arn:iam::123456789012:user:foo has the database user name IAM:foo. Also, permission to call the redshift-serverless:GetCredentials operation is required.
When connecting to a cluster as an IAM identity, specify the cluster identifier and the database name. The database user name is derived from the IAM identity. For example, arn:iam::123456789012:user:foo has the database user name IAM:foo. Also, permission to call the redshift:GetClusterCredentialsWithIAM operation is required.
When connecting to a cluster as a database user, specify the cluster identifier, the database name, and the database user name. Also, permission to call the redshift:GetClusterCredentials operation is required.
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.
See also: AWS API Documentation
Request Syntax
client.execute_statement(
Sql='string',
ClusterIdentifier='string',
SecretArn='string',
DbUser='string',
Database='string',
WithEvent=True|False,
StatementName='string',
Parameters=[
{
'name': 'string',
'value': 'string'
},
],
WorkgroupName='string',
ClientToken='string',
ResultFormat='JSON'|'CSV',
SessionKeepAliveSeconds=123,
SessionId='string',
WaitTimeSeconds=123
)
string
[REQUIRED]
The SQL statement text to run.
string
The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.
string
The name or ARN of the secret that enables access to the database. This parameter is required when authenticating using Secrets Manager.
string
The database user name. This parameter is required when connecting to a cluster as a database user and authenticating using temporary credentials.
string
The name of the database. This parameter is required when authenticating using either Secrets Manager or temporary credentials.
boolean
A value that indicates whether to send an event to the Amazon EventBridge event bus after the SQL statement runs.
string
The name of the SQL statement. You can name the SQL statement when you create it to identify the query.
list
The parameters for the SQL statement.
(dict) --
A parameter used in a SQL statement.
name (string) -- [REQUIRED]
The name of the parameter.
value (string) -- [REQUIRED]
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.
string
The serverless workgroup name or Amazon Resource Name (ARN). This parameter is required when connecting to a serverless workgroup and authenticating using either Secrets Manager or temporary credentials.
string
A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.
This field is autopopulated if not provided.
string
The data format of the result of the SQL statement. If no format is specified, the default is JSON.
integer
The number of seconds to keep the session alive after the query finishes. The maximum time a session can keep alive is 24 hours. After 24 hours, the session is forced closed and the query is terminated.
string
The session identifier of the query.
integer
The number of seconds to wait for the SQL statement to complete execution before returning the response. If the SQL statement does not complete within the specified time, the response returns the current status. The maximum value is 30 seconds.
dict
Response Syntax
{
'Id': 'string',
'CreatedAt': datetime(2015, 1, 1),
'ClusterIdentifier': 'string',
'DbUser': 'string',
'DbGroups': [
'string',
],
'Database': 'string',
'SecretArn': 'string',
'WorkgroupName': 'string',
'SessionId': 'string',
'Status': 'SUBMITTED'|'PICKED'|'STARTED'|'FINISHED'|'ABORTED'|'FAILED',
'RedshiftPid': 123,
'HasResultSet': True|False
}
Response Structure
(dict) --
Id (string) --
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.
CreatedAt (datetime) --
The date and time (UTC) the statement was created.
ClusterIdentifier (string) --
The cluster identifier. This element is not returned when connecting to a serverless workgroup.
DbUser (string) --
The database user name.
DbGroups (list) --
A list of colon (:) separated names of database groups.
(string) --
Database (string) --
The name of the database.
SecretArn (string) --
The name or ARN of the secret that enables access to the database.
WorkgroupName (string) --
The serverless workgroup name or Amazon Resource Name (ARN). This element is not returned when connecting to a provisioned cluster.
SessionId (string) --
The session identifier of the query.
Status (string) --
The status of the SQL statement. Status values are defined as follows:
ABORTED - The query run was stopped by the user.
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.
RedshiftPid (integer) --
The process identifier from Amazon Redshift.
HasResultSet (boolean) --
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.
{'WaitTimeSeconds': 'integer'}
Fetches the temporarily cached result of an SQL statement in JSON format. The ExecuteStatement or BatchExecuteStatement operation that ran the SQL statement must have specified ResultFormat as JSON , or let the format default to JSON. A token is returned to page through the statement results.
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.
See also: AWS API Documentation
Request Syntax
client.get_statement_result(
Id='string',
NextToken='string',
WaitTimeSeconds=123
)
string
[REQUIRED]
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.
string
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.
integer
The number of seconds to wait for the SQL statement to complete execution before returning the result. The maximum value is 30 seconds.
dict
Response Syntax
{
'Records': [
[
{
'isNull': True|False,
'booleanValue': True|False,
'longValue': 123,
'doubleValue': 123.0,
'stringValue': 'string',
'blobValue': b'bytes'
},
],
],
'ColumnMetadata': [
{
'isCaseSensitive': True|False,
'isCurrency': True|False,
'isSigned': True|False,
'label': 'string',
'name': 'string',
'nullable': 123,
'precision': 123,
'scale': 123,
'schemaName': 'string',
'tableName': 'string',
'typeName': 'string',
'length': 123,
'columnDefault': 'string'
},
],
'TotalNumRows': 123,
'NextToken': 'string'
}
Response Structure
(dict) --
Records (list) --
The results of the SQL statement in JSON format.
(list) --
(dict) --
A data value in a column.
isNull (boolean) --
A value that indicates whether the data is NULL.
booleanValue (boolean) --
A value of the Boolean data type.
longValue (integer) --
A value of the long data type.
doubleValue (float) --
A value of the double data type.
stringValue (string) --
A value of the string data type.
blobValue (bytes) --
A value of the BLOB data type.
ColumnMetadata (list) --
The properties (metadata) of a column.
(dict) --
The properties (metadata) of a column.
isCaseSensitive (boolean) --
A value that indicates whether the column is case-sensitive.
isCurrency (boolean) --
A value that indicates whether the column contains currency values.
isSigned (boolean) --
A value that indicates whether an integer column is signed.
label (string) --
The label for the column.
name (string) --
The name of the column.
nullable (integer) --
A value that indicates whether the column is nullable.
precision (integer) --
The precision value of a decimal number column, or the column length for a non-numeric column.
scale (integer) --
The scale value of a decimal number column.
schemaName (string) --
The name of the schema that contains the table that includes the column.
tableName (string) --
The name of the table that includes the column.
typeName (string) --
The database-specific data type of the column.
length (integer) --
The length of the column.
columnDefault (string) --
The default value of the column.
TotalNumRows (integer) --
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.
NextToken (string) --
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.
{'WaitTimeSeconds': 'integer'}
Fetches the temporarily cached result of an SQL statement in CSV format. The ExecuteStatement or BatchExecuteStatement operation that ran the SQL statement must have specified ResultFormat as CSV. A token is returned to page through the statement results.
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.
See also: AWS API Documentation
Request Syntax
client.get_statement_result_v2(
Id='string',
NextToken='string',
WaitTimeSeconds=123
)
string
[REQUIRED]
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.
string
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.
integer
The number of seconds to wait for the SQL statement to complete execution before returning the result. The maximum value is 30 seconds.
dict
Response Syntax
{
'Records': [
{
'CSVRecords': 'string'
},
],
'ColumnMetadata': [
{
'isCaseSensitive': True|False,
'isCurrency': True|False,
'isSigned': True|False,
'label': 'string',
'name': 'string',
'nullable': 123,
'precision': 123,
'scale': 123,
'schemaName': 'string',
'tableName': 'string',
'typeName': 'string',
'length': 123,
'columnDefault': 'string'
},
],
'TotalNumRows': 123,
'ResultFormat': 'JSON'|'CSV',
'NextToken': 'string'
}
Response Structure
(dict) --
Records (list) --
The results of the SQL statement in CSV format.
(dict) --
The results of the SQL statement.
CSVRecords (string) --
The results of the SQL statement in CSV format.
ColumnMetadata (list) --
The properties (metadata) of a column.
(dict) --
The properties (metadata) of a column.
isCaseSensitive (boolean) --
A value that indicates whether the column is case-sensitive.
isCurrency (boolean) --
A value that indicates whether the column contains currency values.
isSigned (boolean) --
A value that indicates whether an integer column is signed.
label (string) --
The label for the column.
name (string) --
The name of the column.
nullable (integer) --
A value that indicates whether the column is nullable.
precision (integer) --
The precision value of a decimal number column, or the column length for a non-numeric column.
scale (integer) --
The scale value of a decimal number column.
schemaName (string) --
The name of the schema that contains the table that includes the column.
tableName (string) --
The name of the table that includes the column.
typeName (string) --
The database-specific data type of the column.
length (integer) --
The length of the column.
columnDefault (string) --
The default value of the column.
TotalNumRows (integer) --
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 GetStatementResultV2 operation needed to page through the results.
ResultFormat (string) --
The data format of the result of the SQL statement.
NextToken (string) --
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.