Table

class aws_cdk.aws_redshift_alpha.Table(scope, id, *, table_columns, dist_style=None, removal_policy=None, sort_style=None, table_comment=None, table_name=None, timeout=None, cluster, database_name, admin_user=None)

Bases: Construct

(experimental) A table in a Redshift cluster.

Stability:

experimental

ExampleMetadata:

fixture=cluster infused

Example:

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
)
Parameters:
  • scope (Construct) –

  • id (str) –

  • table_columns (Sequence[Union[Column, Dict[str, Any]]]) – (experimental) The columns of the table.

  • dist_style (Optional[TableDistStyle]) – (experimental) The distribution style of the table. Default: TableDistStyle.AUTO

  • removal_policy (Optional[RemovalPolicy]) – (experimental) The policy to apply when this resource is removed from the application. Default: cdk.RemovalPolicy.Retain

  • sort_style (Optional[TableSortStyle]) – (experimental) The sort style of the table. Default: TableSortStyle.AUTO if no sort key is specified, TableSortStyle.COMPOUND if a sort key is specified

  • table_comment (Optional[str]) – (experimental) A comment to attach to the table. Default: - no comment

  • table_name (Optional[str]) – (experimental) The name of the table. Default: - a name is generated

  • timeout (Optional[Duration]) – (experimental) Handler timeout duration. Valid values are between 1 second and 15 minutes. Default: - 1 minute

  • cluster (ICluster) – (experimental) The cluster containing the database.

  • database_name (str) – (experimental) The name of the database.

  • admin_user (Optional[ISecret]) – (experimental) The secret containing credentials to a Redshift user with administrator privileges. Secret JSON schema: { username: string; password: string }. Default: - the admin secret is taken from the cluster

Stability:

experimental

Methods

apply_removal_policy(policy)

(experimental) 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.

Parameters:

policy (RemovalPolicy) –

Stability:

experimental

Return type:

None

grant(user, *actions)

(experimental) Grant a user privilege to access this table.

Parameters:
Stability:

experimental

Return type:

None

to_string()

Returns a string representation of this construct.

Return type:

str

Attributes

cluster

(experimental) The cluster where the table is located.

Stability:

experimental

database_name

(experimental) The name of the database where the table is located.

Stability:

experimental

node

The tree node.

table_columns

(experimental) The columns of the table.

Stability:

experimental

table_name

(experimental) Name of the table.

Stability:

experimental

Static Methods

classmethod from_table_attributes(scope, id, *, cluster, database_name, table_columns, table_name)

(experimental) Specify a Redshift table using a table name and schema that already exists.

Parameters:
  • scope (Construct) –

  • id (str) –

  • cluster (ICluster) – (experimental) The cluster where the table is located.

  • database_name (str) – (experimental) The name of the database where the table is located.

  • table_columns (Sequence[Union[Column, Dict[str, Any]]]) – (experimental) The columns of the table.

  • table_name (str) – (experimental) Name of the table.

Stability:

experimental

Return type:

ITable

classmethod is_construct(x)

Checks if x is a construct.

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:

x (Any) – Any object.

Return type:

bool

Returns:

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