Skip to content

Instantly share code, notes, and snippets.

@hadoopsters
Created August 16, 2017 22:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hadoopsters/8995b2bdb0b7f3eef4d229ff74228c64 to your computer and use it in GitHub Desktop.
Save hadoopsters/8995b2bdb0b7f3eef4d229ff74228c64 to your computer and use it in GitHub Desktop.
Export Hive Table to CSV: Method 2
#!/bin/bash
hive -e "drop table if exists csv_dump;
create table csv_dump ROW FORMAT DELIMITED
FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n'
LOCATION '/temp/storage/path' as
select * from my_data_table;"
hadoop fs -getmerge /temp/storage/path/ /local/path/my.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment