Reputation: 8693
I'm trying to export the results of a query to the file system. Everything works fine, except that I can't get the column headers as part of the file. Here's what my script looks like:
set hive.cli.print.header=true;
set mapreduce.task.timeout=0;
set hive.auto.convert.join=false;
set hive.execution.engine=tez;
insert overwrite local directory '/work/output'
ROW FORMAT DELIMTED
FIELDS TERMINATED BY '|'
select...
Am I missing something?
Upvotes: 2
Views: 21110
Reputation: 443
if you use hive cli the below command should give you the file with column name as header.
hive -S -e "set hive.cli.print.header=true;select * from a1;" >out101.text
Upvotes: 6