Skipping header rows in AWS Redshift External Tables

Question:

I have a file in S3 with the following data:

And a redshift external table to query that data using spectrum:

When querying the data I get the following result:

Is there an elegant way to skip the header row as part of the external table definition, similar to the tblproperties ("skip.header.line.count"="1") option in Hive? Or is my only option (at least for now) to filter out the header rows as part of the select statement?

Answer:

Answered this in: How to skip headers when we are reading data from a csv file in s3 and creating a table in aws athena.

This works in Redshift:

You want to use table properties ('skip.header.line.count'='1')
Along with other properties if you want, e.g. 'numRows'='100'.
Here’s a sample:

Leave a Reply