class Table (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.Redshift.Table |
Java | software.amazon.awscdk.services.redshift.Table |
Python | aws_cdk.aws_redshift.Table |
TypeScript (source) | @aws-cdk/aws-redshift » Table |
Implements
IConstruct
, IConstruct
, IDependable
, ITable
A table in a Redshift cluster.
Example
new Table(this, 'Table', {
tableColumns: [
{ name: 'col1', dataType: 'varchar(4)', distKey: true },
{ name: 'col2', dataType: 'float' },
],
cluster: cluster,
databaseName: 'databaseName',
distStyle: TableDistStyle.KEY,
});
Initializer
new Table(scope: Construct, id: string, props: TableProps)
Parameters
- scope
Construct
- id
string
- props
Table
Props
Construct Props
Name | Type | Description |
---|---|---|
cluster | ICluster | The cluster containing the database. |
database | string | The name of the database. |
table | Column [] | The columns of the table. |
admin | ISecret | The secret containing credentials to a Redshift user with administrator privileges. |
dist | Table | The distribution style of the table. |
removal | Removal | The policy to apply when this resource is removed from the application. |
sort | Table | The sort style of the table. |
table | string | The name of the table. |
cluster
Type:
ICluster
The cluster containing the database.
databaseName
Type:
string
The name of the database.
tableColumns
Type:
Column
[]
The columns of the table.
adminUser?
Type:
ISecret
(optional, default: the admin secret is taken from the cluster)
The secret containing credentials to a Redshift user with administrator privileges.
Secret JSON schema: { username: string; password: string }
.
distStyle?
Type:
Table
(optional, default: TableDistStyle.AUTO)
The distribution style of the table.
removalPolicy?
Type:
Removal
(optional, default: cdk.RemovalPolicy.Retain)
The policy to apply when this resource is removed from the application.
sortStyle?
Type:
Table
(optional, default: TableSortStyle.AUTO if no sort key is specified, TableSortStyle.COMPOUND if a sort key is specified)
The sort style of the table.
tableName?
Type:
string
(optional, default: a name is generated)
The name of the table.
Properties
Name | Type | Description |
---|---|---|
cluster | ICluster | The cluster where the table is located. |
database | string | The name of the database where the table is located. |
node | Construct | The construct tree node associated with this construct. |
table | Column [] | The columns of the table. |
table | string | Name of the table. |
cluster
Type:
ICluster
The cluster where the table is located.
databaseName
Type:
string
The name of the database where the table is located.
node
Type:
Construct
The construct tree node associated with this construct.
tableColumns
Type:
Column
[]
The columns of the table.
tableName
Type:
string
Name of the table.
Methods
Name | Description |
---|---|
apply | Apply the given removal policy to this resource. |
grant(user, ...actions) | Grant a user privilege to access this table. |
to | Returns a string representation of this construct. |
static from | Specify a Redshift table using a table name and schema that already exists. |
RemovalPolicy(policy)
applypublic applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
Policy
Apply the given removal policy to this resource.
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.
grant(user, ...actions)
public grant(user: IUser, ...actions: TableAction[]): void
Parameters
- user
IUser
- actions
Table
Action
Grant a user privilege to access this table.
String()
topublic toString(): string
Returns
string
Returns a string representation of this construct.
TableAttributes(scope, id, attrs)
static frompublic static fromTableAttributes(scope: Construct, id: string, attrs: TableAttributes): ITable
Parameters
- scope
Construct
- id
string
- attrs
Table
Attributes
Returns
Specify a Redshift table using a table name and schema that already exists.