Load data from CSV into HIVE table using HUE browser
It may be little tricky to load the data from a CSV file into a HIVE table.
Here is a quick command that can be triggered from HUE editor.
Steps:
1. Upload your CSV file that contains column data only (no headers) into use case directory or application directory in HDFS
2. Run the following command in the HIVE data broswer
LOAD DATA INPATH "/data/applications/appname/table_test_data/testdata.csv" OVERWRITE INTO TABLE testschema.tablename;
3. This will overwrite all the contents in the table with the data from csv file. so existing data in the table will be lost
Make sure the table is already created in the HIVE. You can create the table as follows:
CREATE TABLE tablename(·
strt_tstmp string,
end_tstmp string,
stts_cd int,
)
ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' ·
STORED AS TEXTFILE
Comments