Export as csv in beeline hive

前端 未结 4 1823
忘了有多久
忘了有多久 2020-12-01 11:03

I am trying to export my hive table as a csv in beeline hive. When I run the command !sql select * from database1 > /user/bob/output.csv it gives me syntax e

4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-01 11:41

    You can use this command to save output in CSV format from beeline:

    beeline -u 'jdbc:hive2://bigdataplatform-dev.nam.nsroot.net:10000/;principal=hive/bigdataplatform-dev.net@NAMUXDEV.NET;ssl=true' --outputformat=csv2 --verbose=false  --fastConnect=true   --silent=true -f $query_file>out.csv
    

    Save your SQL query file into $query_file.

    Result will be in out.csv.

    I have complete example here: hivehoney

提交回复
热议问题