Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created on 08-20-2014 04:10 PM - edited 09-16-2022 02:05 AM
How can I export query results to a csv file in Impala shell?
Created 08-20-2014 06:57 PM
Try below syntax. Remove -k if your environment is not kerberosized -
impala-shell -k -i servername:portname -B -q 'select * from table' -o filename '--output_delimiter=\001'
Created 08-20-2014 04:18 PM
Created 08-20-2014 04:22 PM
Thanks a lot for the response, I tried that but somehow its not working, do you have any sample example...
Created 08-20-2014 06:57 PM
Try below syntax. Remove -k if your environment is not kerberosized -
impala-shell -k -i servername:portname -B -q 'select * from table' -o filename '--output_delimiter=\001'
Created 08-24-2015 02:13 AM
Can i do same with JDBC driver in java?
Created 03-25-2017 09:50 AM
This command produces an output file but there is no header. How can I produce an output csv file with a header?
Created on 03-31-2017 05:49 AM - edited 03-31-2017 08:47 AM
I was trying to out put a query to a file after ssh into the server where impala was running. This is the query that i used impala-shell -B -q 'select * from requests limit 1' -o query_result.txt '--output_delimiter=,'
Here is the another way to have a complex query/queries(delimited by 😉 in a file and output result to a file
impala-shell -B -f my-query.txt -o query_result.txt '--output_delimiter=,'
adding headers to the output data
impala-shell -B -f my-query.txt -o query_result.txt --print_header '--output_delimiter=,'
Created 03-31-2017 09:17 AM
Created 08-22-2017 10:28 AM
Created 03-19-2023 10:43 PM
But it will not allow to append result of multiple impala queries. Can it be possible to have any option in the command will will allow user to add results of multiple impala queries result in same output file with headers specific to each query.