4. SQL Statements : CALL VECTORWISE : CSVEXPORT Command
 
Share this page                  
CSVEXPORT Command
The CSVEXPORT command writes a table to a local file system. The result is either a single CSV file or a collection of CSV files, depending on whether the query is run in parallel. The number of files produced cannot be specified, but can be indirectly influenced by setting [engine] max_parallelism_level.
This command has the following format:
CALL VECTORWISE (CSVEXPORT 'table_name, file_name [, null_value]')
where
table_name
Specifies the name of the table to unload.
file_name
Specifies the output location, which can be either a local file system path or a HDFS location URL (only on HDFS installations). If multiple files are created they use the file name with suffixes in the form '.nnn' where nnn is the file number.
null_value
Specifies the text to use for the NULL valued attributes. The default is an empty string.
When a parameter contains commas or spaces, double quotation marks must be used.
Examples:
1. Export data in the table MY TABLE to a file named "my table", and insert the text THIS IS NULL for null values:
CALL VECTORWISE (CSVEXPORT '"MY TABLE", "/tmp/my table", "THIS IS NULL"').
2. Export data in the supplier table to a file named supplier.csv in HDFS location, and insert the text NULL for null values:
CALL VECTORWISE(CSVEXPORT 'supplier, hdfs://your.domain.com:8020/tmp/supplier.csv, NULL')