Export CSV
The COPY TO
clause can export query results to a CSV file, and is used as follows:
The CSV file consists of the following fields:
Nested data types like lists and structs will be represented as strings within their respective columns.
Available options are:
Option | Default Value | Description |
---|---|---|
ESCAPE | \ | Character used to escape special characters in CSV |
DELIM or DELIMITER | , | Character that separates fields in the CSV |
QUOTE | " | Character used to enclose fields containing special characters or spaces |
Header | false | Indicates whether to output a header row |
Another example is shown below.
This outputs the following results to follows.csv
: