Skip to content
v2.273.0

Experimental

@aws-cdk/aws-redshift-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.

Table ​

A table in a Redshift cluster.

Example ​

ts
new Table(this, 'Table', {
  tableColumns: [
    { name: 'col1', dataType: 'varchar(4)', distKey: true },
    { name: 'col2', dataType: 'float' },
  ],
  cluster: cluster,
  databaseName: 'databaseName',
  distStyle: TableDistStyle.KEY,
});
python
from aws_cdk.aws_redshift_alpha import Column, Column
Table(self, "Table",
    table_columns=[Column(name="col1", data_type="varchar(4)", dist_key=True), Column(name="col2", data_type="float")
    ],
    cluster=cluster,
    database_name="databaseName",
    dist_style=TableDistStyle.KEY
)
java
Table.Builder.create(this, "Table")
        .tableColumns(List.of(Column.builder().name("col1").dataType("varchar(4)").distKey(true).build(), Column.builder().name("col2").dataType("float").build()))
        .cluster(cluster)
        .databaseName("databaseName")
        .distStyle(TableDistStyle.KEY)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.AWS.Redshift.Alpha
new Table(this, "Table", new TableProps {
    TableColumns = new [] { new Column { Name = "col1", DataType = "varchar(4)", DistKey = true }, new Column { Name = "col2", DataType = "float" } },
    Cluster = cluster,
    DatabaseName = "databaseName",
    DistStyle = TableDistStyle.KEY
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdkredshiftalpha/v2
awscdkredshiftalpha.NewTable(this, jsii.String("Table"), &TableProps{
	TableColumns: []Column{
		&Column{
			Name: jsii.String("col1"),
			DataType: jsii.String("varchar(4)"),
			DistKey: jsii.Boolean(true),
		},
		&Column{
			Name: jsii.String("col2"),
			DataType: jsii.String("float"),
		},
	},
	Cluster: cluster,
	DatabaseName: jsii.String("databaseName"),
	DistStyle: awscdkredshiftalpha.TableDistStyle_KEY,
})

Initializer ​

ts
new Table(scope: Construct, id: string, props: TableProps)
python
Table(scope: Construct, id: str, props: TableProps)
java
new Table(Construct scope, String id, TableProps props)
csharp
new Table(Construct scope, string id, TableProps props)
go
NewTable(Scope Construct, Id *string, Props TableProps)

Construct Props ​

adminUserISecretadmin_userISecretadminUserISecretAdminUserISecretAdminUserISecret= the admin secret is taken from t…#
The secret containing credentials to a Redshift user with administrator privileges.

Secret JSON schema: { username: string; password: string }.

default

Default: the admin secret is taken from the cluster

clusterIClusterclusterIClusterclusterIClusterClusterIClusterClusterIClusterrequired#
The cluster containing the database.
databaseNamestringdatabase_namestrdatabaseNameStringDatabaseNamestringDatabaseName*stringrequired#
The name of the database.
distStyleTableDistStyledist_styleTableDistStyledistStyleTableDistStyleDistStyleTableDistStyleDistStyleTableDistStyle= TableDistStyle.AUTO#
The distribution style of the table.
removalPolicyRemovalPolicyremoval_policyRemovalPolicyremovalPolicyRemovalPolicyRemovalPolicyRemovalPolicyRemovalPolicyRemovalPolicy= cdk.RemovalPolicy.Retain#
The policy to apply when this resource is removed from the application.
sortStyleTableSortStylesort_styleTableSortStylesortStyleTableSortStyleSortStyleTableSortStyleSortStyleTableSortStyle= TableSortStyle.AUTO if no sort k…#
The sort style of the table.
default

Default: TableSortStyle.AUTO if no sort key is specified, TableSortStyle.COMPOUND if a sort key is specified

tableColumnsColumn[]table_columnstyping.List[Column]tableColumnsList<Column>TableColumnsColumn[]TableColumns*[]Columnrequired#
The columns of the table.
tableCommentstringtable_commentstrtableCommentStringTableCommentstringTableComment*string= no comment#
A comment to attach to the table.
tableNamestringtable_namestrtableNameStringTableNamestringTableName*string= a name is generated#
The name of the table.
timeoutDurationtimeoutDurationtimeoutDurationTimeoutDurationTimeoutDuration= 1 minute#
Handler timeout duration.

Valid values are between 1 second and 15 minutes.

Properties ​

clusterIClusterclusterIClusterclusterIClusterClusterIClusterClusterIClusterrequired#
The cluster where the table is located.
databaseNamestringdatabase_namestrdatabaseNameStringDatabaseNamestringDatabaseName*stringrequired#
The name of the database where the table is located.
nodeNodenodeNodenodeNodeNodeNodeNodeNoderequired#
The tree node.
tableColumnsColumn[]table_columnstyping.List[Column]tableColumnsList<Column>TableColumnsColumn[]TableColumns*[]Columnrequired#
The columns of the table.
tableNamestringtable_namestrtableNameStringTableNamestringTableName*stringrequired#
Name of the table.

Methods ​

applyRemovalPolicy(policy: RemovalPolicy): voiddef apply_removal_policy(self, policy: RemovalPolicy) -> Nonepublic void applyRemovalPolicy(RemovalPolicy policy)public void ApplyRemovalPolicy(RemovalPolicy policy)func ApplyRemovalPolicy(Policy RemovalPolicy)#
Apply the given removal policy to this resource.
notes

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be destroyed (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

This resource is retained by default.

fromTableAttributes(scope: Construct, id: string, attrs: TableAttributes): ITable@staticmethod def from_table_attributes(scope: Construct, id: str, attrs: TableAttributes) -> ITablepublic static ITable fromTableAttributes(Construct scope, String id, TableAttributes attrs)public static ITable FromTableAttributes(Construct scope, string id, TableAttributes attrs)func FromTableAttributes(Scope Construct, Id *string, Attrs TableAttributes) ITablestatic#
Specify a Redshift table using a table name and schema that already exists.
grant(user: IUser, ...actions: TableAction[]): voiddef grant(self, user: IUser, actions: TableAction) -> Nonepublic void grant(IUser user, TableAction actions)public void Grant(IUser user, TableAction actions)func Grant(User IUser, Actions TableAction)#
Grant a user privilege to access this table.
isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#
Checks if `x` is a construct.
notes · 1 parameter · returns

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters

  • xxxxX — Any object.

Returns: true if x is an object created from a class which extends Construct.

toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#
Returns a string representation of this construct.
with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#
Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.

1 parameter · returns

Parameters

  • mixinsmixinsmixinsmixinsMixins — The mixins to apply.

Returns: This construct for chaining