DataFormat Class
Defines the input/output formats and ser/de for a single DataFormat.
Example
ts
declare const myDatabase: glue.Database;
new glue.S3Table(this, 'MyTable', {
database: myDatabase,
columns: [{
name: 'data',
type: glue.Schema.STRING,
}],
partitionKeys: [{
name: 'date',
type: glue.Schema.STRING,
}],
dataFormat: glue.DataFormat.JSON,
partitionProjection: {
date: glue.PartitionProjectionConfiguration.date({
min: 'NOW-3YEARS',
max: 'NOW',
format: 'yyyy-MM-dd',
}),
},
});
python
# my_database: glue.Database
glue.S3Table(self, "MyTable",
database=my_database,
columns=[glue.Column(
name="data",
type=glue.Schema.STRING
)],
partition_keys=[glue.Column(
name="date",
type=glue.Schema.STRING
)],
data_format=glue.DataFormat.JSON,
partition_projection={
"date": glue.PartitionProjectionConfiguration.date(
min="NOW-3YEARS",
max="NOW",
format="yyyy-MM-dd"
)
}
)
java
Database myDatabase;
S3Table.Builder.create(this, "MyTable")
.database(myDatabase)
.columns(List.of(Column.builder()
.name("data")
.type(Schema.STRING)
.build()))
.partitionKeys(List.of(Column.builder()
.name("date")
.type(Schema.STRING)
.build()))
.dataFormat(DataFormat.JSON)
.partitionProjection(Map.of(
"date", PartitionProjectionConfiguration.date(DatePartitionProjectionConfigurationProps.builder()
.min("NOW-3YEARS")
.max("NOW")
.format("yyyy-MM-dd")
.build())))
.build();
csharp
// Install: dotnet add package Amazon.CDK.AWS.Glue.Alpha
Database myDatabase;
new S3Table(this, "MyTable", new S3TableProps {
Database = myDatabase,
Columns = new [] { new Column {
Name = "data",
Type = Schema.STRING
} },
PartitionKeys = new [] { new Column {
Name = "date",
Type = Schema.STRING
} },
DataFormat = DataFormat.JSON,
PartitionProjection = new Dictionary<string, PartitionProjectionConfiguration> {
{ "date", PartitionProjectionConfiguration.Date(new DatePartitionProjectionConfigurationProps {
Min = "NOW-3YEARS",
Max = "NOW",
Format = "yyyy-MM-dd"
}) }
}
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdkgluealpha/v2
var myDatabase Database
glue.NewS3Table(this, jsii.String("MyTable"), &S3TableProps{
Database: myDatabase,
Columns: []Column{
&Column{
Name: jsii.String("data"),
Type: glue.Schema_STRING(),
},
},
PartitionKeys: []Column{
&Column{
Name: jsii.String("date"),
Type: glue.Schema_STRING(),
},
},
DataFormat: glue.DataFormat_JSON(),
PartitionProjection: map[string]PartitionProjectionConfiguration{
"date": glue.PartitionProjectionConfiguration_date(&DatePartitionProjectionConfigurationProps{
"min": jsii.String("NOW-3YEARS"),
"max": jsii.String("NOW"),
"format": jsii.String("yyyy-MM-dd"),
}),
},
})
Initializer
ts
new DataFormat(props: DataFormatProps)
python
DataFormat(props: DataFormatProps)
java
new DataFormat(DataFormatProps props)
csharp
new DataFormat(DataFormatProps props)
go
NewDataFormat(Props DataFormatProps)
Properties
APACHE_LOGSDataFormatapache_logsDataFormatAPACHE_LOGSDataFormatAPACHE_LOGSDataFormatAPACHE_LOGSDataFormatrequiredstatic#DataFormat for Apache Web Server Logs.
Also works for CloudFront logs
DataFormat for Apache Avro.
classificationStringClassificationStringclassification_stringClassificationStringclassificationStringClassificationStringClassificationStringClassificationStringClassificationStringClassificationString#Classification string given to tables with this data format.
CLOUDTRAIL_LOGSDataFormatcloudtrail_logsDataFormatCLOUDTRAIL_LOGSDataFormatCLOUDTRAIL_LOGSDataFormatCLOUDTRAIL_LOGSDataFormatrequiredstatic#DataFormat for CloudTrail logs stored on S3.
DataFormat for CSV Files.
inputFormatInputFormatinput_formatInputFormatinputFormatInputFormatInputFormatInputFormatInputFormatInputFormatrequired#`InputFormat` for this data format.
Stored as plain text files in JSON format.
Uses OpenX Json SerDe for serialization and deseralization.
LOGSTASHDataFormatlogstashDataFormatLOGSTASHDataFormatLOGSTASHDataFormatLOGSTASHDataFormatrequiredstatic#DataFormat for Logstash Logs, using the GROK SerDe.
DataFormat for Apache ORC (Optimized Row Columnar).
outputFormatOutputFormatoutput_formatOutputFormatoutputFormatOutputFormatOutputFormatOutputFormatOutputFormatOutputFormatrequired#`OutputFormat` for this data format.
PARQUETDataFormatparquetDataFormatPARQUETDataFormatPARQUETDataFormatPARQUETDataFormatrequiredstatic#DataFormat for Apache Parquet.
serializationLibrarySerializationLibraryserialization_librarySerializationLibraryserializationLibrarySerializationLibrarySerializationLibrarySerializationLibrarySerializationLibrarySerializationLibraryrequired#Serialization library for this data format.
DataFormat for TSV (Tab-Separated Values).