Export as csv in beeline hive

前端 未结 4 1784
忘了有多久
忘了有多久 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:24

    Output format in CSV:

    $ beeline -u jdbc:hive2://192.168.0.41:10000/test_db -n user1 -p password **--outputformat=csv2** -e "select * from t1";
    

    Output format in custom delimiter:

    $ beeline -u jdbc:hive2://192.168.0.41:10000/test_db -n user1 -p password **--outputformat=dsv** **--delimiterForDSV='|'** -e "select * from t1";
    

    Running command in background and redirect out to file:

    $nohup `$ beeline -u jdbc:hive2://192.168.0.41:10000/test_db -n user1 -p password --outputformat=csv2 -e "select * from t1"; > output.csv 2> log` &
    

    Reference URLs:

    https://dwgeek.com/export-hive-table-into-csv-format-using-beeline-client-example.html/ https://dwgeek.com/hiveserver2-beeline-command-line-shell-options-examples.html/

提交回复
热议问题