interface RedshiftQueryProps
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.Events.Targets.RedshiftQueryProps |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awseventstargets#RedshiftQueryProps |
Java | software.amazon.awscdk.services.events.targets.RedshiftQueryProps |
Python | aws_cdk.aws_events_targets.RedshiftQueryProps |
TypeScript (source) | aws-cdk-lib » aws_events_targets » RedshiftQueryProps |
Configuration properties of an Amazon Redshift Query event.
Example
import * as redshiftserverless from 'aws-cdk-lib/aws-redshiftserverless'
declare const workgroup: redshiftserverless.CfnWorkgroup;
const rule = new events.Rule(this, 'Rule', {
schedule: events.Schedule.rate(cdk.Duration.hours(1)),
});
const dlq = new sqs.Queue(this, 'DeadLetterQueue');
rule.addTarget(new targets.RedshiftQuery(workgroup.attrWorkgroupWorkgroupArn, {
database: 'dev',
deadLetterQueue: dlq,
sql: ['SELECT * FROM foo','SELECT * FROM baz'],
}));
Properties
Name | Type | Description |
---|---|---|
database | string | The Amazon Redshift database to run the query against. |
sql | string[] | The SQL queries to be executed. |
db | string | The Amazon Redshift database user to run the query as. |
dead | IQueue | The queue to be used as dead letter queue. |
input? | Rule | The input to the state machine execution. |
role? | IRole | The IAM role to be used to execute the SQL statement. |
secret? | ISecret | The secret containing the password for the database user. |
send | boolean | Should an event be sent back to Event Bridge when the SQL statement is executed. |
statement | string | The name of the SQL statement. |
database
Type:
string
The Amazon Redshift database to run the query against.
sql
Type:
string[]
The SQL queries to be executed.
Each query is run sequentially within a single transaction; the next query in the array will only execute after the previous one has successfully completed.
- When multiple sql queries are included, this will use the
batchExecuteStatement
API. Therefore, if any statement fails, the entire transaction is rolled back. - If a single SQL statement is to be executed, this will use the
executeStatement
API.
dbUser?
Type:
string
(optional, default: No Database user is specified)
The Amazon Redshift database user to run the query as.
This is required when authenticating via temporary credentials.
deadLetterQueue?
Type:
IQueue
(optional, default: No dead letter queue is specified)
The queue to be used as dead letter queue.
input?
Type:
Rule
(optional, default: the entire EventBridge event)
The input to the state machine execution.
role?
Type:
IRole
(optional, default: a new role will be created.)
The IAM role to be used to execute the SQL statement.
secret?
Type:
ISecret
(optional, default: No secret is specified)
The secret containing the password for the database user.
This is required when authenticating via Secrets Manager. If the full secret ARN is not specified, this will instead use the secret name.
sendEventBridgeEvent?
Type:
boolean
(optional, default: false)
Should an event be sent back to Event Bridge when the SQL statement is executed.
statementName?
Type:
string
(optional, default: No statement name is specified)
The name of the SQL statement.
You can name the SQL statement for identitfication purposes. If you would like Amazon Redshift to identify the Event Bridge rule, and present it in the Amazon Redshift console, append a QS2-
prefix to the statement name.