SDK for PHP 3.x

Client: Aws\RedshiftDataAPIService\RedshiftDataAPIServiceClient
Service ID: redshift-data
Version: 2019-12-20

This page describes the parameters and results for the operations of the Redshift Data API Service (2019-12-20), and shows how to use the Aws\RedshiftDataAPIService\RedshiftDataAPIServiceClient object to call the described operations. This documentation is specific to the 2019-12-20 API version of the service.

Operation Summary

Each of the following operations can be created from a client using $client->getCommand('CommandName'), where "CommandName" is the name of one of the following operations. Note: a command is a value that encapsulates an operation and the parameters used to create an HTTP request.

You can also create and send a command immediately using the magic methods available on a client object: $client->commandName(/* parameters */). You can send the command asynchronously (returning a promise) by appending the word "Async" to the operation name: $client->commandNameAsync(/* parameters */).

BatchExecuteStatement ( array $params = [] )
Runs one or more SQL statements, which can be data manipulation language (DML) or data definition language (DDL).
CancelStatement ( array $params = [] )
Cancels a running query.
DescribeStatement ( array $params = [] )
Describes the details about a specific instance when a query was run by the Amazon Redshift Data API.
DescribeTable ( array $params = [] )
Describes the detailed information about a table from metadata in the cluster.
ExecuteStatement ( array $params = [] )
Runs an SQL statement, which can be data manipulation language (DML) or data definition language (DDL).
GetStatementResult ( array $params = [] )
Fetches the temporarily cached result of an SQL statement.
ListDatabases ( array $params = [] )
List the databases in a cluster.
ListSchemas ( array $params = [] )
Lists the schemas in a database.
ListStatements ( array $params = [] )
List of SQL statements.
ListTables ( array $params = [] )
List the tables in a database.

Paginators

Paginators handle automatically iterating over paginated API results. Paginators are associated with specific API operations, and they accept the parameters that the corresponding API operation accepts. You can get a paginator from a client class using getPaginator($paginatorName, $operationParameters). This client supports the following paginators:

DescribeTable
GetStatementResult
ListDatabases
ListSchemas
ListStatements
ListTables

Operations

BatchExecuteStatement

$result = $client->batchExecuteStatement([/* ... */]);
$promise = $client->batchExecuteStatementAsync([/* ... */]);

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.

Parameter Syntax

$result = $client->batchExecuteStatement([
    'ClientToken' => '<string>',
    'ClusterIdentifier' => '<string>',
    'Database' => '<string>',
    'DbUser' => '<string>',
    'SecretArn' => '<string>',
    'SessionId' => '<string>',
    'SessionKeepAliveSeconds' => <integer>,
    'Sqls' => ['<string>', ...], // REQUIRED
    'StatementName' => '<string>',
    'WithEvent' => true || false,
    'WorkgroupName' => '<string>',
]);

Parameter Details

Members
ClientToken
Type: string

A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.

ClusterIdentifier
Type: string

The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.

Database
Type: string

The name of the database. This parameter is required when authenticating using either Secrets Manager or temporary credentials.

DbUser
Type: string

The database user name. This parameter is required when connecting to a cluster as a database user and authenticating using temporary credentials.

SecretArn
Type: string

The name or ARN of the secret that enables access to the database. This parameter is required when authenticating using Secrets Manager.

SessionId
Type: string

The session identifier of the query.

SessionKeepAliveSeconds
Type: int

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.

Sqls
Required: Yes
Type: Array of strings

One or more SQL statements to run.

 The SQL statements are run as a single transaction. They run serially in the order of the array. Subsequent SQL statements don't start until the previous statement in the array completes. If any SQL statement fails, then because they are run as one transaction, all work is rolled back.</p> 
StatementName
Type: string

The name of the SQL statements. You can name the SQL statements when you create them to identify the query.

WithEvent
Type: boolean

A value that indicates whether to send an event to the Amazon EventBridge event bus after the SQL statements run.

WorkgroupName
Type: 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.

Result Syntax

[
    'ClusterIdentifier' => '<string>',
    'CreatedAt' => <DateTime>,
    'Database' => '<string>',
    'DbGroups' => ['<string>', ...],
    'DbUser' => '<string>',
    'Id' => '<string>',
    'SecretArn' => '<string>',
    'SessionId' => '<string>',
    'WorkgroupName' => '<string>',
]

Result Details

Members
ClusterIdentifier
Type: string

The cluster identifier. This element is not returned when connecting to a serverless workgroup.

CreatedAt
Type: timestamp (string|DateTime or anything parsable by strtotime)

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

Database
Type: string

The name of the database.

DbGroups
Type: Array of strings

A list of colon (:) separated names of database groups.

DbUser
Type: string

The database user name.

Id
Type: 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.

SecretArn
Type: string

The name or ARN of the secret that enables access to the database.

SessionId
Type: string

The session identifier of the query.

WorkgroupName
Type: string

The serverless workgroup name or Amazon Resource Name (ARN). This element is not returned when connecting to a provisioned cluster.

Errors

ValidationException:

The Amazon Redshift Data API operation failed due to invalid input.

ActiveSessionsExceededException:

The Amazon Redshift Data API operation failed because the maximum number of active sessions exceeded.

ActiveStatementsExceededException:

The number of active statements exceeds the limit.

BatchExecuteStatementException:

An SQL statement encountered an environmental error while running.

InternalServerException:

The Amazon Redshift Data API operation failed due to invalid input.

CancelStatement

$result = $client->cancelStatement([/* ... */]);
$promise = $client->cancelStatementAsync([/* ... */]);

Cancels a running query. To be canceled, a query must be running.

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.

Parameter Syntax

$result = $client->cancelStatement([
    'Id' => '<string>', // REQUIRED
]);

Parameter Details

Members
Id
Required: Yes
Type: string

The identifier of the SQL statement to cancel. This value is a universally unique identifier (UUID) generated by Amazon Redshift Data API. This identifier is returned by BatchExecuteStatment, ExecuteStatment, and ListStatements.

Result Syntax

[
    'Status' => true || false,
]

Result Details

Members
Status
Type: boolean

A value that indicates whether the cancel statement succeeded (true).

Errors

ValidationException:

The Amazon Redshift Data API operation failed due to invalid input.

ResourceNotFoundException:

The Amazon Redshift Data API operation failed due to a missing resource.

InternalServerException:

The Amazon Redshift Data API operation failed due to invalid input.

DatabaseConnectionException:

Connection to a database failed.

DescribeStatement

$result = $client->describeStatement([/* ... */]);
$promise = $client->describeStatementAsync([/* ... */]);

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.

Parameter Syntax

$result = $client->describeStatement([
    'Id' => '<string>', // REQUIRED
]);

Parameter Details

Members
Id
Required: Yes
Type: string

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.

Result Syntax

[
    'ClusterIdentifier' => '<string>',
    'CreatedAt' => <DateTime>,
    'Database' => '<string>',
    'DbUser' => '<string>',
    'Duration' => <integer>,
    'Error' => '<string>',
    'HasResultSet' => true || false,
    'Id' => '<string>',
    'QueryParameters' => [
        [
            'name' => '<string>',
            'value' => '<string>',
        ],
        // ...
    ],
    'QueryString' => '<string>',
    'RedshiftPid' => <integer>,
    'RedshiftQueryId' => <integer>,
    'ResultRows' => <integer>,
    'ResultSize' => <integer>,
    'SecretArn' => '<string>',
    'SessionId' => '<string>',
    'Status' => 'SUBMITTED|PICKED|STARTED|FINISHED|ABORTED|FAILED|ALL',
    'SubStatements' => [
        [
            'CreatedAt' => <DateTime>,
            'Duration' => <integer>,
            'Error' => '<string>',
            'HasResultSet' => true || false,
            'Id' => '<string>',
            'QueryString' => '<string>',
            'RedshiftQueryId' => <integer>,
            'ResultRows' => <integer>,
            'ResultSize' => <integer>,
            'Status' => 'SUBMITTED|PICKED|STARTED|FINISHED|ABORTED|FAILED',
            'UpdatedAt' => <DateTime>,
        ],
        // ...
    ],
    'UpdatedAt' => <DateTime>,
    'WorkgroupName' => '<string>',
]

Result Details

Members
ClusterIdentifier
Type: string

The cluster identifier.

CreatedAt
Type: timestamp (string|DateTime or anything parsable by strtotime)

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

Database
Type: string

The name of the database.

DbUser
Type: string

The database user name.

Duration
Type: long (int|float)

The amount of time in nanoseconds that the statement ran.

Error
Type: string

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

HasResultSet
Type: 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.

Id
Required: Yes
Type: string

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

QueryParameters
Type: Array of SqlParameter structures

The parameters for the SQL statement.

QueryString
Type: string

The SQL statement text.

RedshiftPid
Type: long (int|float)

The process identifier from Amazon Redshift.

RedshiftQueryId
Type: long (int|float)

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

ResultRows
Type: long (int|float)

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
Type: long (int|float)

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

SecretArn
Type: string

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

SessionId
Type: string

The session identifier of the query.

Status
Type: 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.

SubStatements
Type: Array of SubStatementData structures

The SQL statements from a multiple statement run.

UpdatedAt
Type: timestamp (string|DateTime or anything parsable by strtotime)

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

WorkgroupName
Type: string

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

Errors

ValidationException:

The Amazon Redshift Data API operation failed due to invalid input.

ResourceNotFoundException:

The Amazon Redshift Data API operation failed due to a missing resource.

InternalServerException:

The Amazon Redshift Data API operation failed due to invalid input.

DescribeTable

$result = $client->describeTable([/* ... */]);
$promise = $client->describeTableAsync([/* ... */]);

Describes the detailed information about a table from metadata in the cluster. The information includes its columns. A token is returned to page through the column list. 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.

Parameter Syntax

$result = $client->describeTable([
    'ClusterIdentifier' => '<string>',
    'ConnectedDatabase' => '<string>',
    'Database' => '<string>', // REQUIRED
    'DbUser' => '<string>',
    'MaxResults' => <integer>,
    'NextToken' => '<string>',
    'Schema' => '<string>',
    'SecretArn' => '<string>',
    'Table' => '<string>',
    'WorkgroupName' => '<string>',
]);

Parameter Details

Members
ClusterIdentifier
Type: string

The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.

ConnectedDatabase
Type: string

A database name. The connected database is specified when you connect with your authentication credentials.

Database
Required: Yes
Type: string

The name of the database that contains the tables to be described. If ConnectedDatabase is not specified, this is also the database to connect to with your authentication credentials.

DbUser
Type: string

The database user name. This parameter is required when connecting to a cluster as a database user and authenticating using temporary credentials.

MaxResults
Type: int

The maximum number of tables to return in the response. If more tables exist than fit in one response, then NextToken is returned to page through the results.

NextToken
Type: 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.

Schema
Type: string

The schema that contains the table. If no schema is specified, then matching tables for all schemas are returned.

SecretArn
Type: string

The name or ARN of the secret that enables access to the database. This parameter is required when authenticating using Secrets Manager.

Table
Type: string

The table name. If no table is specified, then all tables for all matching schemas are returned. If no table and no schema is specified, then all tables for all schemas in the database are returned

WorkgroupName
Type: 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.

Result Syntax

[
    'ColumnList' => [
        [
            'columnDefault' => '<string>',
            'isCaseSensitive' => true || false,
            'isCurrency' => true || false,
            'isSigned' => true || false,
            'label' => '<string>',
            'length' => <integer>,
            'name' => '<string>',
            'nullable' => <integer>,
            'precision' => <integer>,
            'scale' => <integer>,
            'schemaName' => '<string>',
            'tableName' => '<string>',
            'typeName' => '<string>',
        ],
        // ...
    ],
    'NextToken' => '<string>',
    'TableName' => '<string>',
]

Result Details

Members
ColumnList
Type: Array of ColumnMetadata structures

A list of columns in the table.

NextToken
Type: 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.

TableName
Type: string

The table name.

Errors

ValidationException:

The Amazon Redshift Data API operation failed due to invalid input.

QueryTimeoutException:

The Amazon Redshift Data API operation failed due to timeout.

InternalServerException:

The Amazon Redshift Data API operation failed due to invalid input.

DatabaseConnectionException:

Connection to a database failed.

ExecuteStatement

$result = $client->executeStatement([/* ... */]);
$promise = $client->executeStatementAsync([/* ... */]);

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.

Parameter Syntax

$result = $client->executeStatement([
    'ClientToken' => '<string>',
    'ClusterIdentifier' => '<string>',
    'Database' => '<string>',
    'DbUser' => '<string>',
    'Parameters' => [
        [
            'name' => '<string>', // REQUIRED
            'value' => '<string>', // REQUIRED
        ],
        // ...
    ],
    'SecretArn' => '<string>',
    'SessionId' => '<string>',
    'SessionKeepAliveSeconds' => <integer>,
    'Sql' => '<string>', // REQUIRED
    'StatementName' => '<string>',
    'WithEvent' => true || false,
    'WorkgroupName' => '<string>',
]);

Parameter Details

Members
ClientToken
Type: string

A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.

ClusterIdentifier
Type: string

The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.

Database
Type: string

The name of the database. This parameter is required when authenticating using either Secrets Manager or temporary credentials.

DbUser
Type: string

The database user name. This parameter is required when connecting to a cluster as a database user and authenticating using temporary credentials.

Parameters
Type: Array of SqlParameter structures

The parameters for the SQL statement.

SecretArn
Type: string

The name or ARN of the secret that enables access to the database. This parameter is required when authenticating using Secrets Manager.

SessionId
Type: string

The session identifier of the query.

SessionKeepAliveSeconds
Type: int

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.

Sql
Required: Yes
Type: string

The SQL statement text to run.

StatementName
Type: string

The name of the SQL statement. You can name the SQL statement when you create it to identify the query.

WithEvent
Type: boolean

A value that indicates whether to send an event to the Amazon EventBridge event bus after the SQL statement runs.

WorkgroupName
Type: 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.

Result Syntax

[
    'ClusterIdentifier' => '<string>',
    'CreatedAt' => <DateTime>,
    'Database' => '<string>',
    'DbGroups' => ['<string>', ...],
    'DbUser' => '<string>',
    'Id' => '<string>',
    'SecretArn' => '<string>',
    'SessionId' => '<string>',
    'WorkgroupName' => '<string>',
]

Result Details

Members
ClusterIdentifier
Type: string

The cluster identifier. This element is not returned when connecting to a serverless workgroup.

CreatedAt
Type: timestamp (string|DateTime or anything parsable by strtotime)

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

Database
Type: string

The name of the database.

DbGroups
Type: Array of strings

A list of colon (:) separated names of database groups.

DbUser
Type: string

The database user name.

Id
Type: 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.

SecretArn
Type: string

The name or ARN of the secret that enables access to the database.

SessionId
Type: string

The session identifier of the query.

WorkgroupName
Type: string

The serverless workgroup name or Amazon Resource Name (ARN). This element is not returned when connecting to a provisioned cluster.

Errors

ValidationException:

The Amazon Redshift Data API operation failed due to invalid input.

ActiveSessionsExceededException:

The Amazon Redshift Data API operation failed because the maximum number of active sessions exceeded.

ExecuteStatementException:

The SQL statement encountered an environmental error while running.

ActiveStatementsExceededException:

The number of active statements exceeds the limit.

InternalServerException:

The Amazon Redshift Data API operation failed due to invalid input.

GetStatementResult

$result = $client->getStatementResult([/* ... */]);
$promise = $client->getStatementResultAsync([/* ... */]);

Fetches the temporarily cached result of an SQL statement. 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.

Parameter Syntax

$result = $client->getStatementResult([
    'Id' => '<string>', // REQUIRED
    'NextToken' => '<string>',
]);

Parameter Details

Members
Id
Required: Yes
Type: 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. 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.

NextToken
Type: 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.

Result Syntax

[
    'ColumnMetadata' => [
        [
            'columnDefault' => '<string>',
            'isCaseSensitive' => true || false,
            'isCurrency' => true || false,
            'isSigned' => true || false,
            'label' => '<string>',
            'length' => <integer>,
            'name' => '<string>',
            'nullable' => <integer>,
            'precision' => <integer>,
            'scale' => <integer>,
            'schemaName' => '<string>',
            'tableName' => '<string>',
            'typeName' => '<string>',
        ],
        // ...
    ],
    'NextToken' => '<string>',
    'Records' => [
        [
            [
                'blobValue' => <string || resource || Psr\Http\Message\StreamInterface>,
                'booleanValue' => true || false,
                'doubleValue' => <float>,
                'isNull' => true || false,
                'longValue' => <integer>,
                'stringValue' => '<string>',
            ],
            // ...
        ],
        // ...
    ],
    'TotalNumRows' => <integer>,
]

Result Details

Members
ColumnMetadata
Type: Array of ColumnMetadata structures

The properties (metadata) of a column.

NextToken
Type: 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.

Records
Required: Yes
Type: Array of Field structuress

The results of the SQL statement.

TotalNumRows
Type: long (int|float)

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.

Errors

ValidationException:

The Amazon Redshift Data API operation failed due to invalid input.

ResourceNotFoundException:

The Amazon Redshift Data API operation failed due to a missing resource.

InternalServerException:

The Amazon Redshift Data API operation failed due to invalid input.

ListDatabases

$result = $client->listDatabases([/* ... */]);
$promise = $client->listDatabasesAsync([/* ... */]);

List the databases in a cluster. A token is returned to page through the database list. 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.

Parameter Syntax

$result = $client->listDatabases([
    'ClusterIdentifier' => '<string>',
    'Database' => '<string>', // REQUIRED
    'DbUser' => '<string>',
    'MaxResults' => <integer>,
    'NextToken' => '<string>',
    'SecretArn' => '<string>',
    'WorkgroupName' => '<string>',
]);

Parameter Details

Members
ClusterIdentifier
Type: string

The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.

Database
Required: Yes
Type: string

The name of the database. This parameter is required when authenticating using either Secrets Manager or temporary credentials.

DbUser
Type: string

The database user name. This parameter is required when connecting to a cluster as a database user and authenticating using temporary credentials.

MaxResults
Type: int

The maximum number of databases to return in the response. If more databases exist than fit in one response, then NextToken is returned to page through the results.

NextToken
Type: 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.

SecretArn
Type: string

The name or ARN of the secret that enables access to the database. This parameter is required when authenticating using Secrets Manager.

WorkgroupName
Type: 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.

Result Syntax

[
    'Databases' => ['<string>', ...],
    'NextToken' => '<string>',
]

Result Details

Members
Databases
Type: Array of strings

The names of databases.

NextToken
Type: 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.

Errors

ValidationException:

The Amazon Redshift Data API operation failed due to invalid input.

QueryTimeoutException:

The Amazon Redshift Data API operation failed due to timeout.

InternalServerException:

The Amazon Redshift Data API operation failed due to invalid input.

DatabaseConnectionException:

Connection to a database failed.

ListSchemas

$result = $client->listSchemas([/* ... */]);
$promise = $client->listSchemasAsync([/* ... */]);

Lists the schemas in a database. A token is returned to page through the schema list. 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.

Parameter Syntax

$result = $client->listSchemas([
    'ClusterIdentifier' => '<string>',
    'ConnectedDatabase' => '<string>',
    'Database' => '<string>', // REQUIRED
    'DbUser' => '<string>',
    'MaxResults' => <integer>,
    'NextToken' => '<string>',
    'SchemaPattern' => '<string>',
    'SecretArn' => '<string>',
    'WorkgroupName' => '<string>',
]);

Parameter Details

Members
ClusterIdentifier
Type: string

The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.

ConnectedDatabase
Type: string

A database name. The connected database is specified when you connect with your authentication credentials.

Database
Required: Yes
Type: string

The name of the database that contains the schemas to list. If ConnectedDatabase is not specified, this is also the database to connect to with your authentication credentials.

DbUser
Type: string

The database user name. This parameter is required when connecting to a cluster as a database user and authenticating using temporary credentials.

MaxResults
Type: int

The maximum number of schemas to return in the response. If more schemas exist than fit in one response, then NextToken is returned to page through the results.

NextToken
Type: 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.

SchemaPattern
Type: string

A pattern to filter results by schema name. Within a schema pattern, "%" means match any substring of 0 or more characters and "_" means match any one character. Only schema name entries matching the search pattern are returned.

SecretArn
Type: string

The name or ARN of the secret that enables access to the database. This parameter is required when authenticating using Secrets Manager.

WorkgroupName
Type: 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.

Result Syntax

[
    'NextToken' => '<string>',
    'Schemas' => ['<string>', ...],
]

Result Details

Members
NextToken
Type: 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.

Schemas
Type: Array of strings

The schemas that match the request pattern.

Errors

ValidationException:

The Amazon Redshift Data API operation failed due to invalid input.

QueryTimeoutException:

The Amazon Redshift Data API operation failed due to timeout.

InternalServerException:

The Amazon Redshift Data API operation failed due to invalid input.

DatabaseConnectionException:

Connection to a database failed.

ListStatements

$result = $client->listStatements([/* ... */]);
$promise = $client->listStatementsAsync([/* ... */]);

List of SQL statements. By default, only finished statements are shown. A token is returned to page through the statement list.

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.

Parameter Syntax

$result = $client->listStatements([
    'MaxResults' => <integer>,
    'NextToken' => '<string>',
    'RoleLevel' => true || false,
    'StatementName' => '<string>',
    'Status' => 'SUBMITTED|PICKED|STARTED|FINISHED|ABORTED|FAILED|ALL',
]);

Parameter Details

Members
MaxResults
Type: int

The maximum number of SQL statements to return in the response. If more SQL statements exist than fit in one response, then NextToken is returned to page through the results.

NextToken
Type: 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.

RoleLevel
Type: boolean

A value that filters which statements to return in the response. If true, all statements run by the caller's IAM role are returned. If false, only statements run by the caller's IAM role in the current IAM session are returned. The default is true.

StatementName
Type: string

The name of the SQL statement specified as input to BatchExecuteStatement or ExecuteStatement to identify the query. You can list multiple statements by providing a prefix that matches the beginning of the statement name. For example, to list myStatement1, myStatement2, myStatement3, and so on, then provide the a value of myStatement. Data API does a case-sensitive match of SQL statement names to the prefix value you provide.

Status
Type: string

The status of the SQL statement to list. 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.

Result Syntax

[
    'NextToken' => '<string>',
    'Statements' => [
        [
            'CreatedAt' => <DateTime>,
            'Id' => '<string>',
            'IsBatchStatement' => true || false,
            'QueryParameters' => [
                [
                    'name' => '<string>',
                    'value' => '<string>',
                ],
                // ...
            ],
            'QueryString' => '<string>',
            'QueryStrings' => ['<string>', ...],
            'SecretArn' => '<string>',
            'SessionId' => '<string>',
            'StatementName' => '<string>',
            'Status' => 'SUBMITTED|PICKED|STARTED|FINISHED|ABORTED|FAILED|ALL',
            'UpdatedAt' => <DateTime>,
        ],
        // ...
    ],
]

Result Details

Members
NextToken
Type: 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.

Statements
Required: Yes
Type: Array of StatementData structures

The SQL statements.

Errors

ValidationException:

The Amazon Redshift Data API operation failed due to invalid input.

InternalServerException:

The Amazon Redshift Data API operation failed due to invalid input.

ListTables

$result = $client->listTables([/* ... */]);
$promise = $client->listTablesAsync([/* ... */]);

List the tables in a database. If neither SchemaPattern nor TablePattern are specified, then all tables in the database are returned. A token is returned to page through the table list. 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.

Parameter Syntax

$result = $client->listTables([
    'ClusterIdentifier' => '<string>',
    'ConnectedDatabase' => '<string>',
    'Database' => '<string>', // REQUIRED
    'DbUser' => '<string>',
    'MaxResults' => <integer>,
    'NextToken' => '<string>',
    'SchemaPattern' => '<string>',
    'SecretArn' => '<string>',
    'TablePattern' => '<string>',
    'WorkgroupName' => '<string>',
]);

Parameter Details

Members
ClusterIdentifier
Type: string

The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.

ConnectedDatabase
Type: string

A database name. The connected database is specified when you connect with your authentication credentials.

Database
Required: Yes
Type: string

The name of the database that contains the tables to list. If ConnectedDatabase is not specified, this is also the database to connect to with your authentication credentials.

DbUser
Type: string

The database user name. This parameter is required when connecting to a cluster as a database user and authenticating using temporary credentials.

MaxResults
Type: int

The maximum number of tables to return in the response. If more tables exist than fit in one response, then NextToken is returned to page through the results.

NextToken
Type: 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.

SchemaPattern
Type: string

A pattern to filter results by schema name. Within a schema pattern, "%" means match any substring of 0 or more characters and "_" means match any one character. Only schema name entries matching the search pattern are returned. If SchemaPattern is not specified, then all tables that match TablePattern are returned. If neither SchemaPattern or TablePattern are specified, then all tables are returned.

SecretArn
Type: string

The name or ARN of the secret that enables access to the database. This parameter is required when authenticating using Secrets Manager.

TablePattern
Type: string

A pattern to filter results by table name. Within a table pattern, "%" means match any substring of 0 or more characters and "_" means match any one character. Only table name entries matching the search pattern are returned. If TablePattern is not specified, then all tables that match SchemaPatternare returned. If neither SchemaPattern or TablePattern are specified, then all tables are returned.

WorkgroupName
Type: 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.

Result Syntax

[
    'NextToken' => '<string>',
    'Tables' => [
        [
            'name' => '<string>',
            'schema' => '<string>',
            'type' => '<string>',
        ],
        // ...
    ],
]

Result Details

Members
NextToken
Type: 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.

Tables
Type: Array of TableMember structures

The tables that match the request pattern.

Errors

ValidationException:

The Amazon Redshift Data API operation failed due to invalid input.

QueryTimeoutException:

The Amazon Redshift Data API operation failed due to timeout.

InternalServerException:

The Amazon Redshift Data API operation failed due to invalid input.

DatabaseConnectionException:

Connection to a database failed.

Shapes

ActiveSessionsExceededException

Description

The Amazon Redshift Data API operation failed because the maximum number of active sessions exceeded.

Members
Message
Type: string

ActiveStatementsExceededException

Description

The number of active statements exceeds the limit.

Members
Message
Type: string

BatchExecuteStatementException

Description

An SQL statement encountered an environmental error while running.

Members
Message
Required: Yes
Type: string
StatementId
Required: Yes
Type: string

Statement identifier of the exception.

ColumnMetadata

Description

The properties (metadata) of a column.

Members
columnDefault
Type: string

The default value of the column.

isCaseSensitive
Type: boolean

A value that indicates whether the column is case-sensitive.

isCurrency
Type: boolean

A value that indicates whether the column contains currency values.

isSigned
Type: boolean

A value that indicates whether an integer column is signed.

label
Type: string

The label for the column.

length
Type: int

The length of the column.

name
Type: string

The name of the column.

nullable
Type: int

A value that indicates whether the column is nullable.

precision
Type: int

The precision value of a decimal number column.

scale
Type: int

The scale value of a decimal number column.

schemaName
Type: string

The name of the schema that contains the table that includes the column.

tableName
Type: string

The name of the table that includes the column.

typeName
Type: string

The database-specific data type of the column.

DatabaseConnectionException

Description

Connection to a database failed.

Members
Message
Required: Yes
Type: string

ExecuteStatementException

Description

The SQL statement encountered an environmental error while running.

Members
Message
Required: Yes
Type: string

The exception message.

StatementId
Required: Yes
Type: string

Statement identifier of the exception.

Field

Description

A data value in a column.

Members
blobValue
Type: blob (string|resource|Psr\Http\Message\StreamInterface)

A value of the BLOB data type.

booleanValue
Type: boolean

A value of the Boolean data type.

doubleValue
Type: double

A value of the double data type.

isNull
Type: boolean

A value that indicates whether the data is NULL.

longValue
Type: long (int|float)

A value of the long data type.

stringValue
Type: string

A value of the string data type.

InternalServerException

Description

The Amazon Redshift Data API operation failed due to invalid input.

Members
Message
Required: Yes
Type: string

The exception message.

QueryTimeoutException

Description

The Amazon Redshift Data API operation failed due to timeout.

Members
Message
Type: string

ResourceNotFoundException

Description

The Amazon Redshift Data API operation failed due to a missing resource.

Members
Message
Required: Yes
Type: string

The exception message.

ResourceId
Required: Yes
Type: string

Resource identifier associated with the exception.

SqlParameter

Description

A parameter used in a SQL statement.

Members
name
Required: Yes
Type: string

The name of the parameter.

value
Required: Yes
Type: 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.

StatementData

Description

The SQL statement to run.

Members
CreatedAt
Type: timestamp (string|DateTime or anything parsable by strtotime)

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

Id
Required: Yes
Type: string

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

IsBatchStatement
Type: boolean

A value that indicates whether the statement is a batch query request.

QueryParameters
Type: Array of SqlParameter structures

The parameters used in a SQL statement.

QueryString
Type: string

The SQL statement.

QueryStrings
Type: Array of strings

One or more SQL statements. Each query string in the array corresponds to one of the queries in a batch query request.

SecretArn
Type: string

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

SessionId
Type: string

The session identifier of the query.

StatementName
Type: string

The name of the SQL statement.

Status
Type: string

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

UpdatedAt
Type: timestamp (string|DateTime or anything parsable by strtotime)

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

SubStatementData

Description

Information about an SQL statement.

Members
CreatedAt
Type: timestamp (string|DateTime or anything parsable by strtotime)

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

Duration
Type: long (int|float)

The amount of time in nanoseconds that the statement ran.

Error
Type: string

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

HasResultSet
Type: 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.

Id
Required: Yes
Type: 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.

QueryString
Type: string

The SQL statement text.

RedshiftQueryId
Type: long (int|float)

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

ResultRows
Type: long (int|float)

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
Type: long (int|float)

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

Status
Type: string

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

UpdatedAt
Type: timestamp (string|DateTime or anything parsable by strtotime)

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

TableMember

Description

The properties of a table.

Members
name
Type: string

The name of the table.

schema
Type: string

The schema containing the table.

type
Type: string

The type of the table. Possible values include TABLE, VIEW, SYSTEM TABLE, GLOBAL TEMPORARY, LOCAL TEMPORARY, ALIAS, and SYNONYM.

ValidationException

Description

The Amazon Redshift Data API operation failed due to invalid input.

Members
Message
Type: string

The exception message.