# DataFormat

Defines the input/output formats and ser/de for a single DataFormat.

Obtainable from: DataFormat.APACHE_LOGS, DataFormat.AVRO, DataFormat.CLOUDTRAIL_LOGS, DataFormat.CSV, DataFormat.JSON, DataFormat.LOGSTASH, DataFormat.ORC, DataFormat.PARQUET, DataFormat.TSV

- Source: [`aws-glue/lib/data-format.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-glue/lib/data-format.ts#L209)
- Type last changed: v2.270.0 · 17 Sep 2026

## Example

TypeScript:

```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:

```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:

```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();
```

C# / .NET:

```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 = "NOW-3YEARS",
            Max = "NOW",
            Format = "yyyy-MM-dd"
        }) }
    }
});
```

Golang:

```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("NOW-3YEARS"),
			"max": jsii.String("NOW"),
			"format": jsii.String("yyyy-MM-dd"),
		}),
	},
})
```

## Initializer

TypeScript:

```ts
new DataFormat(props: DataFormatProps)
```

Python:

```python
DataFormat(props: DataFormatProps)
```

Java:

```java
new DataFormat(DataFormatProps props)
```

C# / .NET:

```csharp
new DataFormat(DataFormatProps props)
```

Golang:

```go
NewDataFormat(Props DataFormatProps)
```

## Properties

- `APACHE_LOGS`: [DataFormat](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_glue.DataFormat.html) (static) — DataFormat for Apache Web Server Logs.

  Also works for CloudFront logs

- `AVRO`: [DataFormat](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_glue.DataFormat.html) (static) — DataFormat for Apache Avro.

- `classificationString`: [ClassificationString](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_glue.ClassificationString.html) — Classification string given to tables with this data format.

- `CLOUDTRAIL_LOGS`: [DataFormat](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_glue.DataFormat.html) (static) — DataFormat for CloudTrail logs stored on S3.

- `CSV`: [DataFormat](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_glue.DataFormat.html) (static) — DataFormat for CSV Files.

- `inputFormat`: [InputFormat](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_glue.InputFormat.html) — `InputFormat` for this data format.

- `JSON`: [DataFormat](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_glue.DataFormat.html) (static) — Stored as plain text files in JSON format.

  Uses OpenX Json SerDe for serialization and deseralization.

- `LOGSTASH`: [DataFormat](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_glue.DataFormat.html) (static) — DataFormat for Logstash Logs, using the GROK SerDe.

- `ORC`: [DataFormat](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_glue.DataFormat.html) (static) — DataFormat for Apache ORC (Optimized Row Columnar).

- `outputFormat`: [OutputFormat](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_glue.OutputFormat.html) — `OutputFormat` for this data format.

- `PARQUET`: [DataFormat](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_glue.DataFormat.html) (static) — DataFormat for Apache Parquet.

- `serializationLibrary`: [SerializationLibrary](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_glue.SerializationLibrary.html) — Serialization library for this data format.

- `TSV`: [DataFormat](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_glue.DataFormat.html) (static) — DataFormat for TSV (Tab-Separated Values).
