> **Experimental**
>
> `@aws-cdk/aws-redshift-alpha` is an [**experimental**](/stability) (alpha) package: its API may change in any release, without a major version bump.
# Table

A table in a Redshift cluster.

Extends: Construct › Table
Implements: ITable, IConstruct, IDependable

- Stability: [Experimental](/cdk/api/stability.html)
- Source: [`lib/table.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0-alpha.0/packages/@aws-cdk/aws-redshift-alpha/lib/table.ts#L233)

## 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,
});
```

## Initializer

```ts
new Table(scope: Construct, id: string, props: TableProps)
```

## Construct Props

- `adminUser`: [ISecret](/cdk/api/v2/docs/aws-cdk-lib.aws_secretsmanager.ISecret.html) — The secret containing credentials to a Redshift user with administrator privileges.

  **Default:** the admin secret is taken from the cluster

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

- `cluster`: [ICluster](/cdk/api/v2/docs/@aws-cdk_aws-redshift-alpha.ICluster.html) (required) — The cluster containing the database.

- `databaseName`: string (required) — The name of the database.

- `distStyle`: [TableDistStyle](/cdk/api/v2/docs/@aws-cdk_aws-redshift-alpha.TableDistStyle.html) = TableDistStyle.AUTO — The distribution style of the table.

- `removalPolicy`: [RemovalPolicy](/cdk/api/v2/docs/aws-cdk-lib.RemovalPolicy.html) = cdk.RemovalPolicy.Retain — The policy to apply when this resource is removed from the application.

- `sortStyle`: [TableSortStyle](/cdk/api/v2/docs/@aws-cdk_aws-redshift-alpha.TableSortStyle.html) — The sort style of the table.

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

- `tableColumns`: [Column](/cdk/api/v2/docs/@aws-cdk_aws-redshift-alpha.Column.html)[] (required) — The columns of the table.

- `tableComment`: string — A comment to attach to the table.

  **Default:** no comment

- `tableName`: string — The name of the table.

  **Default:** a name is generated

- `timeout`: [Duration](/cdk/api/v2/docs/aws-cdk-lib.Duration.html) — Handler timeout duration.

  **Default:** 1 minute

  Valid values are between 1 second and 15 minutes.

## Properties

- `cluster`: [ICluster](/cdk/api/v2/docs/@aws-cdk_aws-redshift-alpha.ICluster.html) — The cluster where the table is located.

- `databaseName`: string — The name of the database where the table is located.

- `node`: [Node](/cdk/api/v2/docs/constructs.Node.html) — The tree node.

- `tableColumns`: [Column](/cdk/api/v2/docs/@aws-cdk_aws-redshift-alpha.Column.html)[] — The columns of the table.

- `tableName`: string — Name of the table.

## Methods

- `applyRemovalPolicy(policy: RemovalPolicy): void` — 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.

- `fromTableAttributes(scope: Construct, id: string, attrs: TableAttributes): ITable` (static) — Specify a Redshift table using a table name and schema that already exists.

- `grant(user: IUser, ...actions: TableAction[]): void` — Grant a user privilege to access this table.

- `isConstruct(x: any): boolean` (static) — 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 object.

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

- `toString(): string` — Returns a string representation of this construct.

- `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.

  **Parameters**

  - `mixins` — The mixins to apply.

  **Returns:** This construct for chaining
