Search code examples
impalaio-redirection

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

  • 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;