简体   繁体   中英

How to export hive data to csv or txt

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

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 :)

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM