Skip to content
v2.278.0

ExternalTableProps Struct ​

Example ​

ts
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,
});
python
# my_connection: glue.Connection
# my_database: glue.Database

glue.ExternalTable(self, "MyTable",
    connection=my_connection,
    external_data_location="default_db_public_example",  # A table in Redshift
    # ...
    database=my_database,
    columns=[glue.Column(
        name="col1",
        type=glue.Schema.STRING
    )],
    data_format=glue.DataFormat.JSON
)
java
Connection myConnection;
Database myDatabase;

ExternalTable.Builder.create(this, "MyTable")
        .connection(myConnection)
        .externalDataLocation("default_db_public_example") // A table in Redshift
        // ...
        .database(myDatabase)
        .columns(List.of(Column.builder()
                .name("col1")
                .type(Schema.STRING)
                .build()))
        .dataFormat(DataFormat.JSON)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
Connection myConnection;
Database myDatabase;

new ExternalTable(this, "MyTable", new ExternalTableProps {
    Connection = myConnection,
    ExternalDataLocation = "default_db_public_example",  // A table in Redshift
    // ...
    Database = myDatabase,
    Columns = new [] { new Column {
        Name = "col1",
        Type = Schema.STRING
    } },
    DataFormat = DataFormat.JSON
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var myConnection Connection
var myDatabase Database

glue.NewExternalTable(this, jsii.String("MyTable"), &ExternalTableProps{
	Connection: myConnection,
	ExternalDataLocation: jsii.String("default_db_public_example"),
	 // A table in Redshift
	// ...
	Database: myDatabase,
	Columns: []Column{
		&Column{
			Name: jsii.String("col1"),
			Type: glue.Schema_STRING(),
		},
	},
	DataFormat: glue.DataFormat_JSON(),
})

Properties ​

columnsColumn[]columnstyping.List[Column]columnsList<Column>ColumnsColumn[]Columns*[]Column required #
Columns of the table.
compressedoptionalbooleancompressedoptionalboolcompressedoptionalBooleanCompressedoptionalboolCompressedoptional*bool = false #
Indicates whether the table's data is compressed or not.
connectionIConnectionconnectionIConnectionconnectionIConnectionConnectionIConnectionConnectionIConnection required #
The connection the table will use when performing reads and writes.
databaseIDatabasedatabaseIDatabasedatabaseIDatabaseDatabaseIDatabaseDatabaseIDatabase required #
Database in which to store the table.
dataFormatDataFormatdata_formatDataFormatdataFormatDataFormatDataFormatDataFormatDataFormatDataFormat required #
Storage type of the table's data.
descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string = generated #
Description of the table.
enablePartitionFilteringoptionalbooleanenable_partition_filteringoptionalboolenablePartitionFilteringoptionalBooleanEnablePartitionFilteringoptionalboolEnablePartitionFilteringoptional*bool #
Enables partition filtering.

Default: The parameter is not defined

externalDataLocationstringexternal_data_locationstrexternalDataLocationStringExternalDataLocationstringExternalDataLocation*string required #
The data source location of the glue table, (e.g. `default_db_public_example` for Redshift).

This overrides both bucket and s3Prefix.

hasEncryptedDataoptionalbooleanhas_encrypted_dataoptionalboolhasEncryptedDataoptionalBooleanHasEncryptedDataoptionalboolHasEncryptedDataoptional*bool = true #
Whether the data stored in the table is encrypted.
notes

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.

parametersoptional{ [key: string]: string }parametersoptionaltyping.Mapping[str, str]parametersoptionalMap<String, String>ParametersoptionalIDictionary<string, string>Parametersoptional*map[string]*string #
The key/value pairs define properties associated with the table.

Default: The parameter is not defined

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

partitionIndexesoptionalPartitionIndex[]partition_indexesoptionaltyping.List[PartitionIndex]partitionIndexesoptionalList<PartitionIndex>PartitionIndexesoptionalPartitionIndex[]PartitionIndexesoptional*[]PartitionIndex #
Partition indexes on the table.

Default: table has no partition indexes

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

partitionKeysoptionalColumn[]partition_keysoptionaltyping.List[Column]partitionKeysoptionalList<Column>PartitionKeysoptionalColumn[]PartitionKeysoptional*[]Column #
Partition columns of the table.

Default: table is not partitioned

partitionProjectionoptional{ [key: string]: PartitionProjectionConfiguration }partition_projectionoptionaltyping.Mapping[str, PartitionProjectionConfiguration]partitionProjectionoptionalMap<String, PartitionProjectionConfiguration>PartitionProjectionoptionalIDictionary<string, PartitionProjectionConfiguration>PartitionProjectionoptional*map[string]PartitionProjectionConfiguration #
Partition projection configuration for this table.

Default: No partition projection

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

storageParametersoptionalStorageParameter[]storage_parametersoptionaltyping.List[StorageParameter]storageParametersoptionalList<StorageParameter>StorageParametersoptionalStorageParameter[]StorageParametersoptional*[]StorageParameter #
The user-supplied properties for the description of the physical storage of this table.

Default: The parameter is not defined

notes · example

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,
   });
storedAsSubDirectoriesoptionalbooleanstored_as_sub_directoriesoptionalboolstoredAsSubDirectoriesoptionalBooleanStoredAsSubDirectoriesoptionalboolStoredAsSubDirectoriesoptional*bool = false #
Indicates whether the table data is stored in subdirectories.
tableNameoptionalstringtable_nameoptionalstrtableNameoptionalStringTableNameoptionalstringTableNameoptional*string #
Name of the table.

Default: generated by CDK.