DatePartitionProjectionConfigurationProps Struct
Properties for DATE partition projection configuration.
| Source | aws-glue/lib/partition-projection.ts |
|---|---|
| Type last changed |
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: '2020-01-01',
max: '2023-12-31',
format: 'yyyy-MM-dd',
// `step` bundles interval + unit (supply both or neither). Optional at day
// precision or coarser; required when the format is sub-day (e.g. hours).
step: { interval: 1, intervalUnit: glue.DateIntervalUnit.DAYS },
}),
},
});
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="2020-01-01",
max="2023-12-31",
format="yyyy-MM-dd",
# `step` bundles interval + unit (supply both or neither). Optional at day
# precision or coarser; required when the format is sub-day (e.g. hours).
step=glue.DateProjectionStep(interval=1, interval_unit=glue.DateIntervalUnit.DAYS)
)
}
)
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("2020-01-01")
.max("2023-12-31")
.format("yyyy-MM-dd")
// `step` bundles interval + unit (supply both or neither). Optional at day
// precision or coarser; required when the format is sub-day (e.g. hours).
.step(DateProjectionStep.builder().interval(1).intervalUnit(DateIntervalUnit.DAYS).build())
.build())))
.build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
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 = "2020-01-01",
Max = "2023-12-31",
Format = "yyyy-MM-dd",
// `step` bundles interval + unit (supply both or neither). Optional at day
// precision or coarser; required when the format is sub-day (e.g. hours).
Step = new DateProjectionStep { Interval = 1, IntervalUnit = DateIntervalUnit.DAYS }
}) }
}
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/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("2020-01-01"),
"max": jsii.String("2023-12-31"),
"format": jsii.String("yyyy-MM-dd"),
// `step` bundles interval + unit (supply both or neither). Optional at day
// precision or coarser; required when the format is sub-day (e.g. hours).
"step": &DateProjectionStep{
"interval": jsii.Number(1),
"intervalUnit": glue.DateIntervalUnit_DAYS,
},
}),
},
})
Properties
Date format for partition values.
Uses Java SimpleDateFormat patterns.
End date for the partition range (inclusive).
Can be either:
- Fixed date in the format specified by
formatproperty - Relative date using NOW syntax
Same format constraints as min.
Start date for the partition range (inclusive).
Can be either:
- Fixed date in the format specified by
formatproperty (e.g., '2020-01-01' for format 'yyyy-MM-dd') - Relative date using NOW syntax (e.g., 'NOW', 'NOW-3YEARS', 'NOW+1MONTH')
stepoptionalDateProjectionStepstepoptionalDateProjectionStepstepoptionalDateProjectionStepStepoptionalDateProjectionStepStepoptionalDateProjectionStep #Interval step (`interval` + `intervalUnit`) between partition values.
Default: Athena's default step for the format's precision; required when format is sub-day precision
notes
The two are supplied together, so a partial step cannot be expressed. Required when format carries sub-day precision — a field finer than a day, such as hours or AM/PM; at day or coarser precision Athena defaults the step, so it may be omitted.