class Table (construct)
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.S3Tables.Alpha.Table |
![]() | software.amazon.awscdk.services.s3tables.alpha.Table |
![]() | aws_cdk.aws_s3tables_alpha.Table |
![]() | @aws-cdk/aws-s3tables-alpha ยป Table |
Implements
IConstruct
, IDependable
, IResource
, ITable
An S3 Table with helpers.
Example
// Build a table
const sampleTable = new Table(scope, 'ExampleTable', {
tableName: 'example_table',
namespace: namespace,
openTableFormat: OpenTableFormat.ICEBERG,
withoutMetadata: true,
});
// Build a table with an Iceberg Schema
const sampleTableWithSchema = new Table(scope, 'ExampleSchemaTable', {
tableName: 'example_table_with_schema',
namespace: namespace,
openTableFormat: OpenTableFormat.ICEBERG,
icebergMetadata: {
icebergSchema: {
schemaFieldList: [
{
name: 'id',
type: 'int',
required: true,
},
{
name: 'name',
type: 'string',
},
],
},
},
compaction: {
status: Status.ENABLED,
targetFileSizeMb: 128,
},
snapshotManagement: {
status: Status.ENABLED,
maxSnapshotAgeHours: 48,
minSnapshotsToKeep: 5,
},
});
Initializer
new Table(scope: Construct, id: string, props: TableProps)
Parameters
- scope
Construct
- id
string
- props
Table
Props
Construct Props
Name | Type | Description |
---|---|---|
namespace | INamespace | The namespace under which this table is created. |
open | Open | Format of this table. |
table | string | Name of this table, unique within the namespace. |
compaction? | Compaction | Settings governing the Compaction maintenance action. |
iceberg | Iceberg | Contains details about the metadata for an Iceberg table. |
removal | Removal | Controls what happens to this table it it stoped being managed by cloudformation. |
snapshot | Snapshot | Contains details about the snapshot management settings for an Iceberg table. |
without | boolean | If true, indicates that you don't want to specify a schema for the table. |
namespace
Type:
INamespace
The namespace under which this table is created.
openTableFormat
Type:
Open
Format of this table.
Currently, the only supported value is OpenTableFormat.ICEBERG.
tableName
Type:
string
Name of this table, unique within the namespace.
compaction?
Type:
Compaction
(optional, default: Amazon S3 selects the best compaction strategy based on your table sort order.)
Settings governing the Compaction maintenance action.
icebergMetadata?
Type:
Iceberg
(optional, default: table is created without any metadata)
Contains details about the metadata for an Iceberg table.
removalPolicy?
Type:
Removal
(optional, default: RETAIN)
Controls what happens to this table it it stoped being managed by cloudformation.
snapshotManagement?
Type:
Snapshot
(optional, default: enabled: MinimumSnapshots is 1 by default and MaximumSnapshotAge is 120 hours by default.)
Contains details about the snapshot management settings for an Iceberg table.
withoutMetadata?
Type:
boolean
(optional, default: false)
If true, indicates that you don't want to specify a schema for the table.
This property is mutually exclusive to 'IcebergMetadata'.
Properties
Name | Type | Description |
---|---|---|
env | Resource | The environment this resource belongs to. |
namespace | INamespace | The namespace containing this table. |
node | Node | The tree node. |
stack | Stack | The stack in which this resource is defined. |
table | string | The unique Amazon Resource Name (arn) of this table. |
table | string | The name of this table. |
static PROPERTY_INJECTION_ID | string | Uniquely identifies this class. |
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.
namespace
Type:
INamespace
The namespace containing this table.
node
Type:
Node
The tree node.
stack
Type:
Stack
The stack in which this resource is defined.
tableArn
Type:
string
The unique Amazon Resource Name (arn) of this table.
tableName
Type:
string
The name of this table.
static PROPERTY_INJECTION_ID
Type:
string
Uniquely identifies this class.
Methods
Name | Description |
---|---|
apply | Apply the given removal policy to this resource. |
to | Returns a string representation of this construct. |
static from | Defines a Table construct that represents an external table. |
static validate | See https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-tables-buckets-naming.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
).
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.
static fromTableAttributes(scope, id, attrs)
public static fromTableAttributes(scope: Construct, id: string, attrs: TableAttributes): ITable
Parameters
- scope
Construct
โ The parent creating construct (usuallythis
). - id
string
โ The construct's name. - attrs
Table
โ AAttributes TableAttributes
object containing the table name and ARN.
Returns
Defines a Table construct that represents an external table.
static validateTableName(tableName)
public static validateTableName(tableName: string): void
Parameters
- tableName
string
โ Name of the table.