'Output contents of query to file from within impala-shell

I am trying to extract some information from a Hive table and when I run a describe db.tablename statement within impala-shell, I see that the output is ~2000 lines.

How can I extract this information into a local file without exiting the interactive mode? I could only find references to do it by passing the -o parameter when launching impala-shell



Solution 1:[1]

I couldn't find a reference to this in the docs, but this works -

within impala-shell we can do

set output_file=blah.csv;
select * from dbname.table_name limit 1000;
unset output_file;

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mortz