class S3Table (construct)
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.Glue.Alpha.S3Table |
![]() | github.com/aws/aws-cdk-go/awscdkgluealpha/v2#S3Table |
![]() | software.amazon.awscdk.services.glue.alpha.S3Table |
![]() | aws_cdk.aws_glue_alpha.S3Table |
![]() | @aws-cdk/aws-glue-alpha ยป S3Table |
Implements
IConstruct
, IDependable
, IResource
, ITable
A Glue table that targets a S3 dataset.
Example
declare const myDatabase: glue.Database;
new glue.S3Table(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,
enablePartitionFiltering: true,
});
Initializer
new S3Table(scope: Construct, id: string, props: S3TableProps)
Parameters
- scope
Construct
- id
string
- props
S3
Table Props
Construct Props
Name | Type | Description |
---|---|---|
columns | Column [] | Columns of the table. |
data | Data | Storage type of the table's data. |
database | IDatabase | Database in which to store the table. |
bucket? | IBucket | S3 bucket in which to store data. |
compressed? | boolean | Indicates whether the table's data is compressed or not. |
description? | string | Description of the table. |
enable | boolean | Enables partition filtering. |
encryption? | Table | The kind of encryption to secure the data with. |
encryption | IKey | External KMS key to use for bucket encryption. |
parameters? | { [string]: string } | The key/value pairs define properties associated with the table. |
partition | Partition [] | Partition indexes on the table. |
partition | Column [] | Partition columns of the table. |
s3 | string | S3 prefix under which table objects are stored. |
storage | Storage [] | The user-supplied properties for the description of the physical storage of this table. |
stored | boolean | Indicates whether the table data is stored in subdirectories. |
table | string | Name of the table. |
columns
Type:
Column
[]
Columns of the table.
dataFormat
Type:
Data
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.
encryption?
Type:
Table
(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
.
parameters?
Type:
{ [string]: string }
(optional, default: 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?
Type:
Partition
[]
(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.
storageParameters?
Type:
Storage
[]
(optional, default: 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.
See also: [https://docs.aws.amazon.com/redshift/latest/dg/r_CREATE_EXTERNAL_TABLE.html#r_CREATE_EXTERNAL_TABLE-parameters - under "TABLE PROPERTIES"](https://docs.aws.amazon.com/redshift/latest/dg/r_CREATE_EXTERNAL_TABLE.html#r_CREATE_EXTERNAL_TABLE-parameters - under "TABLE PROPERTIES") Example
declare const glueDatabase: glue.IDatabase;
const table = new glue.Table(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?
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
Name | Type | Description |
---|---|---|
bucket | IBucket | S3 bucket in which the table's data resides. |
columns | Column [] | This table's columns. |
compressed | boolean | Indicates whether the table's data is compressed or not. |
data | Data | Format of this table's data files. |
database | IDatabase | Database this table belongs to. |
encryption | Table | The type of encryption enabled for the table. |
env | Resource | The environment this resource belongs to. |
node | Node | The tree node. |
s3 | string | S3 Key Prefix under which this table's files are stored in S3. |
stack | Stack | The stack in which this resource is defined. |
table | string | ARN of this table. |
table | string | Name of this table. |
table | Cfn | |
encryption | IKey | The KMS key used to secure the data if encryption is set to CSE-KMS or SSE-KMS . |
partition | Partition [] | This table's partition indexes. |
partition | Column [] | This table's partition keys if the table is partitioned. |
storage | Storage [] | The tables' storage descriptor properties. |
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:
Data
Format of this table's data files.
database
Type:
IDatabase
Database this table belongs to.
encryption
Type:
Table
The type of encryption enabled for the table.
env
Type:
Resource
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.
tableResource
Type:
Cfn
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:
Partition
[]
(optional)
This table's partition indexes.
partitionKeys?
Type:
Column
[]
(optional)
This table's partition keys if the table is partitioned.
storageParameters?
Type:
Storage
[]
(optional)
The tables' storage descriptor properties.
Methods
Name | Description |
---|---|
add | Add a partition index to the table. |
apply | Apply the given removal policy to this resource. |
grant(grantee, actions) | Grant the given identity custom permissions. |
grant | Grant read permissions to the table and the underlying data stored in S3 to an IAM principal. |
grant | Grant read and write permissions to the table and the underlying data stored in S3 to an IAM principal. |
grant | Grant the given identity custom permissions to ALL underlying resources of the table. |
grant | Grant write permissions to the table and the underlying data stored in S3 to an IAM principal. |
to | Returns a string representation of this construct. |
protected generate |
addPartitionIndex(index)
public addPartitionIndex(index: PartitionIndex): void
Parameters
- index
Partition
Index
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
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 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 the given identity custom permissions.
grantRead(grantee)
public grantRead(grantee: IGrantable): Grant
Parameters
- grantee
IGrantable
โ the principal.
Returns
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 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 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 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.
protected generateS3PrefixForGrant()
protected generateS3PrefixForGrant(): string
Returns
string