class ExternalTable (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.Glue.Alpha.ExternalTable |
Go | github.com/aws/aws-cdk-go/awscdkgluealpha/v2#ExternalTable |
Java | software.amazon.awscdk.services.glue.alpha.ExternalTable |
Python | aws_cdk.aws_glue_alpha.ExternalTable |
TypeScript (source) | @aws-cdk/aws-glue-alpha ยป ExternalTable |
Implements
IConstruct
, IDependable
, IResource
, ITable
A Glue table that targets an external data location (e.g. A table in a Redshift Cluster).
Example
declare const myConnection: glue.Connection;
declare const myDatabase: glue.Database;
new glue.ExternalTable(this, 'MyTable', {
connection: myConnection,
externalDataLocation: 'default_db_public_example', // A table in Redshift
// ...
database: myDatabase,
columns: [{
name: 'col1',
type: glue.Schema.STRING,
}],
dataFormat: glue.DataFormat.JSON,
});
Initializer
new ExternalTable(scope: Construct, id: string, props: ExternalTableProps)
Parameters
- scope
Construct
- id
string
- props
External
Table Props
Construct Props
Name | Type | Description |
---|---|---|
columns | Column [] | Columns of the table. |
connection | IConnection | The connection the table will use when performing reads and writes. |
data | Data | Storage type of the table's data. |
database | IDatabase | Database in which to store the table. |
external | string | The data source location of the glue table, (e.g. default_db_public_example for Redshift). |
compressed? | boolean | Indicates whether the table's data is compressed or not. |
description? | string | Description of the table. |
enable | boolean | Enables partition filtering. |
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. |
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.
connection
Type:
IConnection
The connection the table will use when performing reads and writes.
dataFormat
Type:
Data
Storage type of the table's data.
database
Type:
IDatabase
Database in which to store the table.
externalDataLocation
Type:
string
The data source location of the glue table, (e.g. default_db_public_example
for Redshift).
If this property is set, it will override both bucket
and s3Prefix
.
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.
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.
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 |
---|---|---|
columns | Column [] | This table's columns. |
compressed | boolean | Indicates whether the table's data is compressed or not. |
connection | IConnection | The connection associated to this table. |
data | Data | Format of this table's data files. |
database | IDatabase | Database this table belongs to. |
env | Resource | The environment this resource belongs to. |
node | Node | The tree node. |
stack | Stack | The stack in which this resource is defined. |
table | string | ARN of this table. |
table | string | Name of this table. |
table | Cfn | |
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. |
columns
Type:
Column
[]
This table's columns.
compressed
Type:
boolean
Indicates whether the table's data is compressed or not.
connection
Type:
IConnection
The connection associated to this table.
dataFormat
Type:
Data
Format of this table's data files.
database
Type:
IDatabase
Database this table belongs to.
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.
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
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. |
grant | Grant read and write permissions to the table. |
grant | Grant the given identity custom permissions to ALL underlying resources of the table. |
grant | Grant write permissions to the table. |
to | Returns a string representation of this construct. |
PartitionIndex(index)
addpublic 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
RemovalPolicy(policy)
applypublic 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.
Read(grantee)
grantpublic grantRead(grantee: IGrantable): Grant
Parameters
- grantee
IGrantable
โ the principal.
Returns
Grant read permissions to the table.
ReadWrite(grantee)
grantpublic grantReadWrite(grantee: IGrantable): Grant
Parameters
- grantee
IGrantable
โ the principal.
Returns
Grant read and write permissions to the table.
ToUnderlyingResources(grantee, actions)
grantpublic 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.
Write(grantee)
grantpublic grantWrite(grantee: IGrantable): Grant
Parameters
- grantee
IGrantable
โ the principal.
Returns
Grant write permissions to the table.
String()
topublic toString(): string
Returns
string
Returns a string representation of this construct.