In Hive, I am trying to write output of an SQL query in csv file using below commands:
!outputformat csv
!record /export/homes/ajain/Automation.BankA_QA_23June.csv
select * from system.catalog limit 10; -- sample SQL query
!record
But the data written in CSV file is enclosed in quotes (shown below), Is there a way to get the data without Header and quotes?
File:
Saving all output to*********************** -- Header
'Column1','Column2'
'Data1' , 'Data2'
Dale K
28.1k15 gold badges60 silver badges86 bronze badges
1 Answer 1
Use Beeline Hive’s CLI for unquoted CSV without headers in a single step.
beeline --silent=true --showHeader=false --outputformat=csv2 -u "jdbc:hive2://<your_hiveserver2>" -e "SELECT * FROM system.catalog LIMIT 10;" > /export/homes/ajain/Automation.BankA_QA_23June.csv
Where:
--showHeader=false: Suppresses column headers.
--outputformat=csv2: Generates unquoted CSV.
--silent=true: Omits Beeline logs/notices.
answered Jun 23, 2025 at 23:00
kapandron
4,2202 gold badges29 silver badges42 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
Explore related questions
See similar questions with these tags.
lang-sql