How to export result of select statement in prestodb.io

user3171954 picture user3171954 · Jan 8, 2014 · Viewed 21.6k times · Source

Two things.

  1. How can I execute an sql statement without "presto-cli-0.56-executable.jar", for example I want to provide a web interface where people could write query and see the output on web
  2. How to export the result of the select statement into a file?

Answer

Damien Carol picture Damien Carol · Feb 17, 2014

Simple answer :

presto --execute "select * from foo" --output-format CSV > foo.csv

You can use these formats :

ALIGNED
VERTICAL
CSV
TSV
CSV_HEADER
TSV_HEADER