CsvOptions

class aws_cdk.aws_dynamodb.CsvOptions(*, delimiter=None, header_list=None)

Bases: object

The options for imported source files in CSV format.

Parameters:
  • delimiter (Optional[str]) – The delimiter used for separating items in the CSV file being imported. Valid delimiters are as follows: - comma (,) - tab (\t) - colon (:) - semicolon (;) - pipe (|) - space (`` ``) Default: - use comma as a delimiter.

  • header_list (Optional[Sequence[str]]) – List of the headers used to specify a common header for all source CSV files being imported. NOTE: If this field is specified then the first line of each CSV file is treated as data instead of the header. If this field is not specified the the first line of each CSV file is treated as the header. Default: - the first line of the CSV file is treated as the header

ExampleMetadata:

infused

Example:

import aws_cdk as cdk
import aws_cdk.aws_s3 as s3

# bucket: s3.IBucket


app = cdk.App()
stack = cdk.Stack(app, "Stack")

dynamodb.Table(stack, "Table",
    partition_key=dynamodb.Attribute(
        name="id",
        type=dynamodb.AttributeType.STRING
    ),
    import_source=dynamodb.ImportSourceSpecification(
        compression_type=dynamodb.InputCompressionType.GZIP,
        input_format=dynamodb.InputFormat.csv(
            delimiter=",",
            header_list=["id", "name"]
        ),
        bucket=bucket,
        key_prefix="prefix"
    )
)

Attributes

delimiter

The delimiter used for separating items in the CSV file being imported.

Valid delimiters are as follows:

  • comma (,)

  • tab (\t)

  • colon (:)

  • semicolon (;)

  • pipe (|)

  • space (`` ``)

Default:
  • use comma as a delimiter.

header_list

List of the headers used to specify a common header for all source CSV files being imported.

NOTE: If this field is specified then the first line of each CSV file is treated as data instead of the header. If this field is not specified the the first line of each CSV file is treated as the header.

Default:
  • the first line of the CSV file is treated as the header