Search code examples
export-to-csvimpala

Save Impala Shell query results in CSV


How can I save my query results in a CSV file via the Impala Shell.

My Code:

impala-shell -q "use test;
select * from teams;
-- From this point I need to save the query results to /Desktop (for example).
"

The problem that I am getting is that I have to select the DB first and then operate the query, but I only see syntax commands that directly uses the query instead of using the DB and then the query.


Solution

  • Found it.

    impala-shell -B -o output.csv --output_delimiter=',' -q "use test;
    select * from teams;"