Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Aws Athena - Create external table skipping first row

I'm trying to create an external table on csv files with Aws Athena with the code below but the line TBLPROPERTIES ("skip.header.line.count"="1") doesn't work: it doesn't skip the first line (header) of the csv file.

CREATE EXTERNAL TABLE mytable (   colA string,   colB int   )   ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.OpenCSVSerde'  WITH SERDEPROPERTIES (    'separatorChar' = ',',    'quoteChar' = '\"',    'escapeChar' = '\\'    ) STORED AS TEXTFILE LOCATION 's3://mybucket/mylocation/' TBLPROPERTIES (   "skip.header.line.count"="1") 

Any advise?

like image 763
nicola Avatar asked Sep 27 '17 15:09

nicola


People also ask

Why do I get zero records when I query my Amazon Athena table?

Incorrect LOCATION path If the input LOCATION path is incorrect, then Athena returns zero records.

What is lazy simple SerDe?

PDFRSS. Specifying this SerDe is optional. This is the SerDe for data in CSV, TSV, and custom-delimited formats that Athena uses by default. This SerDe is used if you don't specify any SerDe and only specify ROW FORMAT DELIMITED .

How do I create a table from a CSV file in Athena?

Use a CREATE TABLE statement to create an Athena table based on the data. Reference the OpenCSVSerDe class after ROW FORMAT SERDE and specify the character separator, quote character, and escape character in WITH SERDEPROPERTIES , as in the following example.

How do you write custom SerDe in AWS Athena?

You specify a SerDe type by listing it explicitly in the ROW FORMAT part of your CREATE TABLE statement in Athena. In some cases, you can omit the SerDe name because Athena uses some SerDe types by default for certain types of data formats.


1 Answers

Just tried the "skip.header.line.count"="1" and seems to be working fine now.

like image 194
Filippo Loddo Avatar answered Oct 12 '22 15:10

Filippo Loddo