Last active
April 22, 2019 16:22
-
-
Save y2k-shubham/5cdf9d03c97f8ae5eab9ea5a5c78fa00 to your computer and use it in GitHub Desktop.
Hive Create table DDL statement for CSV file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- DO NOT use this; see comment below | |
CREATE EXTERNAL TABLE `db_name.table_name`( | |
`column_1` string, | |
`column_2` string) | |
ROW FORMAT SERDE | |
'org.apache.hadoop.hive.serde2.OpenCSVSerde' | |
WITH SERDEPROPERTIES ( | |
'escapeChar'='\\', | |
'quoteChar'='"', | |
'separatorChar'=',') | |
STORED AS INPUTFORMAT | |
'org.apache.hadoop.mapred.TextInputFormat' | |
OUTPUTFORMAT | |
'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat' | |
LOCATION | |
's3://my-bucket/db_name.db/table_name' | |
TBLPROPERTIES ( | |
'skip.header.line.count'='1'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
note that in above (
hive.serde2.OpenCSVSerde
)to preserve types, use following
note that in above