# TableBase

A Glue table.

Extends: Construct › Resource › TableBase
Implements: ITable, IResource, IEnvironmentAware, IConstruct, IDependable
Superclass of: ExternalTable, S3Table

- Source: [`lib/table-base.ts`](https://github.com/aws/aws-cdk/blob/v2.273.0-alpha.0/packages/@aws-cdk/aws-glue-alpha/lib/table-base.ts#L199)
- Type last changed: v2.270.0-alpha.0 · 18 Sep 2026

## Example

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as glue_alpha from '@aws-cdk/aws-glue-alpha';
const tableBase = glue_alpha.TableBase.fromTableArn(this, 'MyTableBase', 'tableArn');
```

## Initializer

```ts
new TableBase(scope: Construct, id: string, props: TableBaseProps)
```

## Construct Props

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

- `compressed`: boolean = false — Indicates whether the table's data is compressed or not.

- `database`: [IDatabase](/cdk/api/v2/docs/@aws-cdk_aws-glue-alpha.IDatabase.html) (required) — Database in which to store the table.

- `dataFormat`: [DataFormat](/cdk/api/v2/docs/@aws-cdk_aws-glue-alpha.DataFormat.html) (required) — Storage type of the table's data.

- `description`: string = generated — Description of the table.

- `enablePartitionFiltering`: boolean = The parameter is not defined — Enables partition filtering.

- `hasEncryptedData`: boolean = true — Whether the data stored in the table is encrypted.

  This sets the `has_encrypted_data` table parameter. Athena reads it when
  querying client-side (CSE-KMS) encrypted datasets; for server-side
  encrypted (SSE-S3 / SSE-KMS) or unencrypted data it has no effect, since
  Amazon S3 decrypts server-side encrypted objects transparently.

  Do not also set `has_encrypted_data` through `parameters` - use this
  property instead. A conflicting value in `parameters` is rejected.

- `parameters`: { [key: string]: string } = The parameter is not defined — The key/value pairs define properties associated with the table.

  The key/value pairs that are allowed to be submitted are not limited, however their functionality is not guaranteed.

- `partitionIndexes`: [PartitionIndex](/cdk/api/v2/docs/@aws-cdk_aws-glue-alpha.PartitionIndex.html)[] = table has no partition indexes — Partition indexes on the table.

  A maximum of 3 indexes
  are allowed on a table. Keys in the index must be part
  of the table's partition keys.

- `partitionKeys`: [Column](/cdk/api/v2/docs/@aws-cdk_aws-glue-alpha.Column.html)[] = table is not partitioned — Partition columns of the table.

- `partitionProjection`: { [key: string]: [PartitionProjectionConfiguration](/cdk/api/v2/docs/@aws-cdk_aws-glue-alpha.PartitionProjectionConfiguration.html) } = No partition projection — Partition projection configuration for this table.

  Partition projection allows Athena to automatically add new partitions
  without requiring `ALTER TABLE ADD PARTITION` statements.

- `storageParameters`: [StorageParameter](/cdk/api/v2/docs/@aws-cdk_aws-glue-alpha.StorageParameter.html)[] = The parameter is not defined — The user-supplied properties for the description of the physical storage of this table.

  These properties help describe the format of the data that is stored within the crawled data sources.

  The key/value pairs that are allowed to be submitted are not limited, however their functionality is not guaranteed.

  Some keys will be auto-populated by glue crawlers, however, you can override them by specifying the key and value in this property.

  ```ts
     declare const glueDatabase: glue.IDatabase;
     const table = new glue.S3Table(this, 'Table', {
       storageParameters: [
           glue.StorageParameter.skipHeaderLineCount(1),
           glue.StorageParameter.compressionType(glue.CompressionType.GZIP),
           glue.StorageParameter.custom('foo', 'bar'), // Will have no effect
           glue.StorageParameter.custom('separatorChar', ','), // Will describe the separator char used in the data
           glue.StorageParameter.custom(glue.StorageParameters.WRITE_PARALLEL, 'off'),
       ],
       // ...
       database: glueDatabase,
       columns: [{
           name: 'col1',
           type: glue.Schema.STRING,
       }],
       dataFormat: glue.DataFormat.CSV,
     });
  ```

- `storedAsSubDirectories`: boolean = false — Indicates whether the table data is stored in subdirectories.

- `tableName`: string = generated by CDK. — Name of the table.

## Properties

- `columns`: [Column](/cdk/api/v2/docs/@aws-cdk_aws-glue-alpha.Column.html)[] (required) — This table's columns.

- `compressed`: boolean (required) — Indicates whether the table's data is compressed or not.

- `database`: [IDatabase](/cdk/api/v2/docs/@aws-cdk_aws-glue-alpha.IDatabase.html) (required) — Database this table belongs to.

- `dataFormat`: [DataFormat](/cdk/api/v2/docs/@aws-cdk_aws-glue-alpha.DataFormat.html) (required) — Format of this table's data files.

- `env`: [ResourceEnvironment](/cdk/api/v2/docs/aws-cdk-lib.interfaces.ResourceEnvironment.html) (required) — The environment this resource belongs to.

  For resources that are created and managed in a Stack (those created by
  creating new class instances like `new Role()`, `new Bucket()`, etc.), this
  is always the same as the environment of the stack they belong to.

  For referenced resources (those obtained from referencing methods like
  `Role.fromRoleArn()`, `Bucket.fromBucketName()`, etc.), they might be
  different than the stack they were imported into.

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

- `partitionIndexes`: [PartitionIndex](/cdk/api/v2/docs/@aws-cdk_aws-glue-alpha.PartitionIndex.html)[]

- `partitionKeys`: [Column](/cdk/api/v2/docs/@aws-cdk_aws-glue-alpha.Column.html)[] — This table's partition keys if the table is partitioned.

- `partitionProjection`: { [key: string]: [PartitionProjectionConfiguration](/cdk/api/v2/docs/@aws-cdk_aws-glue-alpha.PartitionProjectionConfiguration.html) } — This table's partition projection configuration if enabled.

- `stack`: [Stack](/cdk/api/v2/docs/aws-cdk-lib.Stack.html) (required) — The stack in which this resource is defined.

- `storageParameters`: [StorageParameter](/cdk/api/v2/docs/@aws-cdk_aws-glue-alpha.StorageParameter.html)[] — The tables' storage descriptor properties.

- `tableArn`: string (required)

- `tableName`: string (required)

## Methods

- `addPartitionIndex(index: PartitionIndex): void` — Add a partition index to the table.

  You can have a maximum of 3 partition
  indexes to a table. Partition index keys must be a subset of the table's
  partition keys.

- `applyCrossStackReferenceStrength(strength: ReferenceStrength): void` — Override the cross-stack reference strength for this resource.

  When set, any cross-stack reference to this resource will use the specified
  mechanism instead of the global default determined by the
  `@aws-cdk/core:defaultCrossStackReferences` context key. This is useful for
  selectively weakening specific references to avoid the "deadly embrace" problem
  without changing the app-wide default.

  **Parameters**

  - `strength` — - The reference strength to use for this resource.

- `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 deleted (`RemovalPolicy.DESTROY`), or left in your AWS
  account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).

- `fromTableArn(scope: Construct, id: string, tableArn: string): ITable` (static)

- `fromTableAttributes(scope: Construct, id: string, attrs: TableAttributes): ITable` (static) — Creates a Table construct that represents an external table.

  **Parameters**

  - `scope` — The scope creating construct (usually `this`).
  - `id` — The construct's id.
  - `attrs` — Import attributes.

- `grant(grantee: IGrantable, actions: string[]): Grant` — Grant the given identity custom permissions on this table.

  This is a low-level escape hatch: the `actions` are applied verbatim,
  scoped to this table's ARN. Prefer the intent-based `grantRead` /
  `grantWrite` / `grantReadWrite` methods, which grant a curated set of
  actions and also cover the underlying S3 data. Only pass the specific
  actions the grantee needs - avoid service wildcards such as `glue:*`.
  [disable-awslint:no-grants]

  **Parameters**

  - `grantee` — the principal.
  - `actions` — the set of Glue actions to allow (for example `glue:GetTable`).

- `grantRead(grantee: IGrantable): Grant`

- `grantReadWrite(grantee: IGrantable): Grant`

- `grantToUnderlyingResources(grantee: IGrantable, actions: string[]): Grant` — Grant the given identity custom permissions on this table AND its parent catalog and database.

  This is a low-level escape hatch for actions (such as certain Lake
  Formation or crawler operations) that must be authorized against the
  catalog and database in addition to the table. The `actions` are applied
  verbatim to all three ARNs (table, catalog, database), so scope them
  tightly: pass only the specific actions the grantee needs and avoid
  service wildcards such as `glue:*`, which would grant broad access across
  every resource in the catalog and database.
  [disable-awslint:no-grants]

  **Parameters**

  - `grantee` — the principal.
  - `actions` — the set of Glue actions to allow (for example `glue:GetTable`).

- `grantWrite(grantee: IGrantable): Grant`

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

- `isOwnedResource(construct: IConstruct): boolean` (static) — Returns true if the construct was created by CDK, and false otherwise.

- `isResource(construct: IConstruct): boolean` (static) — Check whether the given construct is a Resource.

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