@aws-cdk_aws-glue-alpha.Table

class Table (construct) ๐Ÿ”น

LanguageType name
.NETAmazon.CDK.AWS.Glue.Alpha.Table
Gogithub.com/aws/aws-cdk-go/awscdkgluealpha/v2#Table
Javasoftware.amazon.awscdk.services.glue.alpha.Table
Pythonaws_cdk.aws_glue_alpha.Table
TypeScript (source)@aws-cdk/aws-glue-alpha ยป Table

Implements IConstruct, IDependable, IResource, ITable

A Glue table.

Example

declare const myDatabase: glue.Database;
new glue.Table(this, 'MyTable', {
  database: myDatabase,
  columns: [{
    name: 'col1',
    type: glue.Schema.STRING,
  }],
  partitionKeys: [{
    name: 'year',
    type: glue.Schema.SMALL_INT,
  }, {
    name: 'month',
    type: glue.Schema.SMALL_INT,
  }],
  dataFormat: glue.DataFormat.JSON,
});

Initializer

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

Parameters

  • scope Construct
  • id string
  • props TableProps

Construct Props

NameTypeDescription
columns๐Ÿ”นColumn[]Columns of the table.
dataFormat๐Ÿ”นDataFormatStorage type of the table's data.
database๐Ÿ”นIDatabaseDatabase in which to store the table.
bucket?๐Ÿ”นIBucketS3 bucket in which to store data.
compressed?๐Ÿ”นbooleanIndicates whether the table's data is compressed or not.
description?๐Ÿ”นstringDescription of the table.
enablePartitionFiltering?๐Ÿ”นbooleanEnables partition filtering.
encryption?๐Ÿ”นTableEncryptionThe kind of encryption to secure the data with.
encryptionKey?๐Ÿ”นIKeyExternal KMS key to use for bucket encryption.
partitionIndexes?๐Ÿ”นPartitionIndex[]Partition indexes on the table.
partitionKeys?๐Ÿ”นColumn[]Partition columns of the table.
s3Prefix?๐Ÿ”นstringS3 prefix under which table objects are stored.
storedAsSubDirectories?๐Ÿ”นbooleanIndicates whether the table data is stored in subdirectories.
tableName?๐Ÿ”นstringName of the table.

columns๐Ÿ”น

Type: Column[]

Columns of the table.


dataFormat๐Ÿ”น

Type: DataFormat

Storage type of the table's data.


database๐Ÿ”น

Type: IDatabase

Database in which to store the table.


bucket?๐Ÿ”น

Type: IBucket (optional, default: one is created for you)

S3 bucket in which to store data.


compressed?๐Ÿ”น

Type: boolean (optional, default: false)

Indicates whether the table's data is compressed or not.


description?๐Ÿ”น

Type: string (optional, default: generated)

Description of the table.


enablePartitionFiltering?๐Ÿ”น

Type: boolean (optional, default: The parameter is not defined)

Enables partition filtering.

See also: https://docs.aws.amazon.com/athena/latest/ug/glue-best-practices.html#glue-best-practices-partition-index


encryption?๐Ÿ”น

Type: TableEncryption (optional, default: BucketEncryption.S3_MANAGED)

The kind of encryption to secure the data with.

You can only provide this option if you are not explicitly passing in a bucket.

If you choose SSE-KMS, you can provide an un-managed KMS key with encryptionKey. If you choose CSE-KMS, you must provide an un-managed KMS key with encryptionKey.


encryptionKey?๐Ÿ”น

Type: IKey (optional, default: key is managed by KMS.)

External KMS key to use for bucket encryption.

The encryption property must be SSE-KMS or CSE-KMS.


partitionIndexes?๐Ÿ”น

Type: PartitionIndex[] (optional, default: 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?๐Ÿ”น

Type: Column[] (optional, default: table is not partitioned)

Partition columns of the table.


s3Prefix?๐Ÿ”น

Type: string (optional, default: No prefix. The data will be stored under the root of the bucket.)

S3 prefix under which table objects are stored.


storedAsSubDirectories?๐Ÿ”น

Type: boolean (optional, default: false)

Indicates whether the table data is stored in subdirectories.


tableName?๐Ÿ”น

Type: string (optional, default: generated by CDK.)

Name of the table.

Properties

NameTypeDescription
bucket๐Ÿ”นIBucketS3 bucket in which the table's data resides.
columns๐Ÿ”นColumn[]This table's columns.
compressed๐Ÿ”นbooleanIndicates whether the table's data is compressed or not.
dataFormat๐Ÿ”นDataFormatFormat of this table's data files.
database๐Ÿ”นIDatabaseDatabase this table belongs to.
encryption๐Ÿ”นTableEncryptionThe type of encryption enabled for the table.
env๐Ÿ”นResourceEnvironmentThe environment this resource belongs to.
node๐Ÿ”นNodeThe tree node.
s3Prefix๐Ÿ”นstringS3 Key Prefix under which this table's files are stored in S3.
stack๐Ÿ”นStackThe stack in which this resource is defined.
tableArn๐Ÿ”นstringARN of this table.
tableName๐Ÿ”นstringName of this table.
encryptionKey?๐Ÿ”นIKeyThe KMS key used to secure the data if encryption is set to CSE-KMS or SSE-KMS.
partitionIndexes?๐Ÿ”นPartitionIndex[]This table's partition indexes.
partitionKeys?๐Ÿ”นColumn[]This table's partition keys if the table is partitioned.

bucket๐Ÿ”น

Type: IBucket

S3 bucket in which the table's data resides.


columns๐Ÿ”น

Type: Column[]

This table's columns.


compressed๐Ÿ”น

Type: boolean

Indicates whether the table's data is compressed or not.


dataFormat๐Ÿ”น

Type: DataFormat

Format of this table's data files.


database๐Ÿ”น

Type: IDatabase

Database this table belongs to.


encryption๐Ÿ”น

Type: TableEncryption

The type of encryption enabled for the table.


env๐Ÿ”น

Type: ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.


node๐Ÿ”น

Type: Node

The tree node.


s3Prefix๐Ÿ”น

Type: string

S3 Key Prefix under which this table's files are stored in S3.


stack๐Ÿ”น

Type: Stack

The stack in which this resource is defined.


tableArn๐Ÿ”น

Type: string

ARN of this table.


tableName๐Ÿ”น

Type: string

Name of this table.


encryptionKey?๐Ÿ”น

Type: IKey (optional)

The KMS key used to secure the data if encryption is set to CSE-KMS or SSE-KMS.

Otherwise, undefined.


partitionIndexes?๐Ÿ”น

Type: PartitionIndex[] (optional)

This table's partition indexes.


partitionKeys?๐Ÿ”น

Type: Column[] (optional)

This table's partition keys if the table is partitioned.

Methods

NameDescription
addPartitionIndex(index)๐Ÿ”นAdd a partition index to the table.
applyRemovalPolicy(policy)๐Ÿ”นApply the given removal policy to this resource.
grant(grantee, actions)๐Ÿ”นGrant the given identity custom permissions.
grantRead(grantee)๐Ÿ”นGrant read permissions to the table and the underlying data stored in S3 to an IAM principal.
grantReadWrite(grantee)๐Ÿ”นGrant read and write permissions to the table and the underlying data stored in S3 to an IAM principal.
grantToUnderlyingResources(grantee, actions)๐Ÿ”นGrant the given identity custom permissions to ALL underlying resources of the table.
grantWrite(grantee)๐Ÿ”นGrant write permissions to the table and the underlying data stored in S3 to an IAM principal.
toString()๐Ÿ”นReturns a string representation of this construct.
static fromTableArn(scope, id, tableArn)๐Ÿ”น
static fromTableAttributes(scope, id, attrs)๐Ÿ”นCreates a Table construct that represents an external table.

addPartitionIndex(index)๐Ÿ”น

public addPartitionIndex(index: PartitionIndex): void

Parameters

  • index PartitionIndex

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.

See also: https://docs.aws.amazon.com/glue/latest/dg/partition-indexes.html


applyRemovalPolicy(policy)๐Ÿ”น

public applyRemovalPolicy(policy: RemovalPolicy): void

Parameters

  • policy RemovalPolicy

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


grant(grantee, actions)๐Ÿ”น

public grant(grantee: IGrantable, actions: string[]): Grant

Parameters

  • grantee IGrantable
  • actions string[]

Returns

  • Grant

Grant the given identity custom permissions.


grantRead(grantee)๐Ÿ”น

public grantRead(grantee: IGrantable): Grant

Parameters

  • grantee IGrantable โ€” the principal.

Returns

  • Grant

Grant read permissions to the table and the underlying data stored in S3 to an IAM principal.


grantReadWrite(grantee)๐Ÿ”น

public grantReadWrite(grantee: IGrantable): Grant

Parameters

  • grantee IGrantable โ€” the principal.

Returns

  • Grant

Grant read and write permissions to the table and the underlying data stored in S3 to an IAM principal.


grantToUnderlyingResources(grantee, actions)๐Ÿ”น

public grantToUnderlyingResources(grantee: IGrantable, actions: string[]): Grant

Parameters

  • grantee IGrantable
  • actions string[]

Returns

  • Grant

Grant the given identity custom permissions to ALL underlying resources of the table.

Permissions will be granted to the catalog, the database, and the table.


grantWrite(grantee)๐Ÿ”น

public grantWrite(grantee: IGrantable): Grant

Parameters

  • grantee IGrantable โ€” the principal.

Returns

  • Grant

Grant write permissions to the table and the underlying data stored in S3 to an IAM principal.


toString()๐Ÿ”น

public toString(): string

Returns

  • string

Returns a string representation of this construct.


static fromTableArn(scope, id, tableArn)๐Ÿ”น

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

Parameters

  • scope Construct
  • id string
  • tableArn string

Returns

  • ITable

static fromTableAttributes(scope, id, attrs)๐Ÿ”น

public static fromTableAttributes(scope: Construct, id: string, attrs: TableAttributes): ITable

Parameters

  • scope Construct โ€” The scope creating construct (usually this).
  • id string โ€” The construct's id.
  • attrs TableAttributes โ€” Import attributes.

Returns

  • ITable

Creates a Table construct that represents an external table.