| Copyright | (c) 2013-2023 Brendan Hay |
|---|---|
| License | Mozilla Public License, v. 2.0. |
| Maintainer | Brendan Hay |
| Stability | auto-generated |
| Portability | non-portable (GHC extensions) |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Amazonka.RedshiftData.ExecuteStatement
Description
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, specify the Amazon Resource Name (ARN) of the secret, the database name, and the cluster identifier that matches the cluster in the secret. When connecting to a serverless workgroup, specify the Amazon Resource Name (ARN) of the secret and the database name.
- Temporary credentials - when connecting to a cluster, specify the
cluster identifier, the database name, and the database user name.
Also, permission to call the
redshift:GetClusterCredentialsoperation is required. When connecting to a serverless workgroup, specify the workgroup name and database name. Also, permission to call theredshift-serverless:GetCredentialsoperation 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.
Synopsis
- data ExecuteStatement = ExecuteStatement' {
- clientToken :: Maybe Text
- clusterIdentifier :: Maybe Text
- dbUser :: Maybe Text
- parameters :: Maybe (NonEmpty SqlParameter)
- secretArn :: Maybe Text
- statementName :: Maybe Text
- withEvent :: Maybe Bool
- workgroupName :: Maybe Text
- database :: Text
- sql :: Text
- newExecuteStatement :: Text -> Text -> ExecuteStatement
- executeStatement_clientToken :: Lens' ExecuteStatement (Maybe Text)
- executeStatement_clusterIdentifier :: Lens' ExecuteStatement (Maybe Text)
- executeStatement_dbUser :: Lens' ExecuteStatement (Maybe Text)
- executeStatement_parameters :: Lens' ExecuteStatement (Maybe (NonEmpty SqlParameter))
- executeStatement_secretArn :: Lens' ExecuteStatement (Maybe Text)
- executeStatement_statementName :: Lens' ExecuteStatement (Maybe Text)
- executeStatement_withEvent :: Lens' ExecuteStatement (Maybe Bool)
- executeStatement_workgroupName :: Lens' ExecuteStatement (Maybe Text)
- executeStatement_database :: Lens' ExecuteStatement Text
- executeStatement_sql :: Lens' ExecuteStatement Text
- data ExecuteStatementResponse = ExecuteStatementResponse' {}
- newExecuteStatementResponse :: Int -> ExecuteStatementResponse
- executeStatementResponse_clusterIdentifier :: Lens' ExecuteStatementResponse (Maybe Text)
- executeStatementResponse_createdAt :: Lens' ExecuteStatementResponse (Maybe UTCTime)
- executeStatementResponse_database :: Lens' ExecuteStatementResponse (Maybe Text)
- executeStatementResponse_dbUser :: Lens' ExecuteStatementResponse (Maybe Text)
- executeStatementResponse_id :: Lens' ExecuteStatementResponse (Maybe Text)
- executeStatementResponse_secretArn :: Lens' ExecuteStatementResponse (Maybe Text)
- executeStatementResponse_workgroupName :: Lens' ExecuteStatementResponse (Maybe Text)
- executeStatementResponse_httpStatus :: Lens' ExecuteStatementResponse Int
Creating a Request
data ExecuteStatement Source #
See: newExecuteStatement smart constructor.
Constructors
| ExecuteStatement' | |
Fields
| |
Instances
Arguments
| :: Text | |
| -> Text | |
| -> ExecuteStatement |
Create a value of ExecuteStatement with all optional fields omitted.
Use generic-lens or optics to modify other optional fields.
The following record fields are available, with the corresponding lenses provided for backwards compatibility:
$sel:clientToken:ExecuteStatement', executeStatement_clientToken - A unique, case-sensitive identifier that you provide to ensure the
idempotency of the request.
ExecuteStatement, executeStatement_clusterIdentifier - The cluster identifier. This parameter is required when connecting to a
cluster and authenticating using either Secrets Manager or temporary
credentials.
ExecuteStatement, executeStatement_dbUser - The database user name. This parameter is required when connecting to a
cluster and authenticating using temporary credentials.
$sel:parameters:ExecuteStatement', executeStatement_parameters - The parameters for the SQL statement.
ExecuteStatement, executeStatement_secretArn - The name or ARN of the secret that enables access to the database. This
parameter is required when authenticating using Secrets Manager.
ExecuteStatement, executeStatement_statementName - The name of the SQL statement. You can name the SQL statement when you
create it to identify the query.
$sel:withEvent:ExecuteStatement', executeStatement_withEvent - A value that indicates whether to send an event to the Amazon
EventBridge event bus after the SQL statement runs.
ExecuteStatement, executeStatement_workgroupName - The serverless workgroup name. This parameter is required when
connecting to a serverless workgroup and authenticating using either
Secrets Manager or temporary credentials.
ExecuteStatement, executeStatement_database - The name of the database. This parameter is required when authenticating
using either Secrets Manager or temporary credentials.
$sel:sql:ExecuteStatement', executeStatement_sql - The SQL statement text to run.
Request Lenses
executeStatement_clientToken :: Lens' ExecuteStatement (Maybe Text) Source #
A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.
executeStatement_clusterIdentifier :: Lens' ExecuteStatement (Maybe Text) Source #
The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.
executeStatement_dbUser :: Lens' ExecuteStatement (Maybe Text) Source #
The database user name. This parameter is required when connecting to a cluster and authenticating using temporary credentials.
executeStatement_parameters :: Lens' ExecuteStatement (Maybe (NonEmpty SqlParameter)) Source #
The parameters for the SQL statement.
executeStatement_secretArn :: Lens' ExecuteStatement (Maybe Text) Source #
The name or ARN of the secret that enables access to the database. This parameter is required when authenticating using Secrets Manager.
executeStatement_statementName :: Lens' ExecuteStatement (Maybe Text) Source #
The name of the SQL statement. You can name the SQL statement when you create it to identify the query.
executeStatement_withEvent :: Lens' ExecuteStatement (Maybe Bool) Source #
A value that indicates whether to send an event to the Amazon EventBridge event bus after the SQL statement runs.
executeStatement_workgroupName :: Lens' ExecuteStatement (Maybe Text) Source #
The serverless workgroup name. This parameter is required when connecting to a serverless workgroup and authenticating using either Secrets Manager or temporary credentials.
executeStatement_database :: Lens' ExecuteStatement Text Source #
The name of the database. This parameter is required when authenticating using either Secrets Manager or temporary credentials.
executeStatement_sql :: Lens' ExecuteStatement Text Source #
The SQL statement text to run.
Destructuring the Response
data ExecuteStatementResponse Source #
See: newExecuteStatementResponse smart constructor.
Constructors
| ExecuteStatementResponse' | |
Fields
| |
Instances
newExecuteStatementResponse Source #
Create a value of ExecuteStatementResponse with all optional fields omitted.
Use generic-lens or optics to modify other optional fields.
The following record fields are available, with the corresponding lenses provided for backwards compatibility:
ExecuteStatement, executeStatementResponse_clusterIdentifier - The cluster identifier. This element is not returned when connecting to
a serverless workgroup.
ExecuteStatementResponse, executeStatementResponse_createdAt - The date and time (UTC) the statement was created.
ExecuteStatement, executeStatementResponse_database - The name of the database.
ExecuteStatement, executeStatementResponse_dbUser - The database user name.
ExecuteStatementResponse, executeStatementResponse_id - 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.
ExecuteStatement, executeStatementResponse_secretArn - The name or ARN of the secret that enables access to the database.
ExecuteStatement, executeStatementResponse_workgroupName - The serverless workgroup name. This element is not returned when
connecting to a provisioned cluster.
$sel:httpStatus:ExecuteStatementResponse', executeStatementResponse_httpStatus - The response's http status code.
Response Lenses
executeStatementResponse_clusterIdentifier :: Lens' ExecuteStatementResponse (Maybe Text) Source #
The cluster identifier. This element is not returned when connecting to a serverless workgroup.
executeStatementResponse_createdAt :: Lens' ExecuteStatementResponse (Maybe UTCTime) Source #
The date and time (UTC) the statement was created.
executeStatementResponse_database :: Lens' ExecuteStatementResponse (Maybe Text) Source #
The name of the database.
executeStatementResponse_dbUser :: Lens' ExecuteStatementResponse (Maybe Text) Source #
The database user name.
executeStatementResponse_id :: Lens' ExecuteStatementResponse (Maybe Text) Source #
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.
executeStatementResponse_secretArn :: Lens' ExecuteStatementResponse (Maybe Text) Source #
The name or ARN of the secret that enables access to the database.
executeStatementResponse_workgroupName :: Lens' ExecuteStatementResponse (Maybe Text) Source #
The serverless workgroup name. This element is not returned when connecting to a provisioned cluster.
executeStatementResponse_httpStatus :: Lens' ExecuteStatementResponse Int Source #
The response's http status code.