Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save cvargas-xbrein/9bcdcf6a60e5ce6b2e1d24173837ba82 to your computer and use it in GitHub Desktop.
Save cvargas-xbrein/9bcdcf6a60e5ce6b2e1d24173837ba82 to your computer and use it in GitHub Desktop.
Create a table in Athena from a csv file with header stored in S3.
CREATE EXTERNAL TABLE IF NOT EXISTS default.table
(
`id` int,
`name` string,
`timestamp` string,
`is_debug` boolean
)
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.OpenCSVSerde'
WITH SERDEPROPERTIES (
'escapeChar'='\\',
'quoteChar'='\"',
'serialization.format' = ',',
'field.delim' = ','
)
LOCATION 's3://your-bucket-name-xxxxx/your/folder'
TBLPROPERTIES (
'skip.header.line.count'='1'
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment