Sunday, 27 January 2019


How to export hive table


In order to download hive table as csv file, we can do the following



Give the below command in terminal,then the result will be stored in the specified path with in the form of csv.here just we want to print header of the hive table also.

so add below property in the command

set hive.cli.print.header=true


Full command below

hive -e 'set hive.cli.print.header=true;use India; select * from Tamilnadu' | sed 's/[\t]/,/g'  > /yourlocalpath/yourfile.csv

1.added header by using property
2.chosen the table using query
3.replaced tab delimiter with comma delimiter to make it as csv(comma seperated values)

No comments:

Post a Comment