S3 Select CSV Headers

前端 未结 3 1662
独厮守ぢ
独厮守ぢ 2021-01-13 08:12

I am using S3 Select to read csv file from S3 Bucket and outputting as CSV. In the output I only see rows, but not headers. How do I get output with headers included.

<
3条回答
  •  -上瘾入骨i
    2021-01-13 08:30

    Change InputSerialization={'CSV': {"FileHeaderInfo": "Use"}},

    TO InputSerialization={'CSV': {"FileHeaderInfo": "NONE"}},

    Then, it will print full content, including the header.

    Explanation:

    FileHeaderInfo accepts one of "NONE|USE|IGNORE".

    Use NONE option rather then USE, it will then print header as well, as NONE tells that you need header as well for processing.

    Here is reference. https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3.html#S3.Client.select_object_content

    I hope it helps.

提交回复
热议问题