-2

how to export hive into a csv or txt in a big data, the data are more than 10000, and i use hue browser to export it.

i already tried insert overwrite local directory code, but it didn't work

  • Possible duplicate of [How to export a Hive table into a CSV file?](https://stackoverflow.com/questions/17086642/how-to-export-a-hive-table-into-a-csv-file) – vikrant rana Jul 04 '19 at 06:49

2 Answers2

1
INSERT OVERWRITE LOCAL DIRECTORY '/tmp/dir/file1'
ROW FORMAT DELIMITED FIELDS TERMINATED BY ','
SELECT * from tablename;

come out of hive cli

go to this /tmp/dir/ location

cat file1/* > file1.csv

zip file1 file1.csv

winscp it to windows and enjoy :)

Sagar Morakhia
  • 777
  • 6
  • 13
0

You can query your data from the command line as such:

hive -e 'select x from table1' > /your/directory/data.csv

Refer to this solution for more info:

How do I output the results of a HiveQL query to CSV?

skhan
  • 199
  • 10