· 7 years ago · Dec 14, 2018, 06:34 PM
1-- create data
2select * from (
3values
4 ('test-a1', 'test-a2'),
5 ('test-b1', 'test-b2'),
6 ('test-c1', 'test-c2')
7) x(col1, col2)
8
9-- load csv from s3
10select * from default.temp_table;
11
12CREATE EXTERNAL TABLE IF NOT EXISTS default.temp_table (
13 `id` string,
14 `name` string
15)
16ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.OpenCSVSerde'
17WITH SERDEPROPERTIES (
18 "separatorChar" = ",",
19 "escapeChar" = "\\"
20) LOCATION 's3://my-bucket/athena-temp/'
21TBLPROPERTIES (
22 'has_encrypted_data'='false',
23 'skip.header.line.count'='1'
24);