Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: toc edit, grammar


For sample workflows on how to export job results to your FTP server, view Treasure Boxes.


Table of Contents


  • Basic knowledge of Treasure Data, including the TD toolbelt.

  • An FTP server

Basic Usage

You can limit


access to your endpoint by using a list of static IPs. Contact if you need it.

Get your


Credential for your FTP(S)



Obtain your credential to access your FTP(S) server.

Write the



Navigate to the TD Console query editor page and compile your query.


If you want to connect to FTP Server with FTPS(explicit) or FTPES(implicit), check select Use SSL? and select proper options.

Image RemovedImage Added

Execute the



Either save the query with a name and run or just run the query. Upon successful completion of the query, its result will be automatically imported to the specified Container destination:


Code Block
$ td query --result '{"type":"ftp","host":"xx.xx.xx.xx","port":21,"username":"xxxx","password":"xxxxx","passive_mode":true,"ascii_mode":true,"ssl":true,"ssl_explicit":true,"ssl_verify":false,"ssl_verify_hostname":false,"path_prefix":"/path/to/file","file_ext":".csv","sequence_format":"","header_line":true,"quote_policy":"MINIMAL","delimiter":",","null_string":"","newline":"CRLF"}' -d sample_datasets "select * from www_access" -T presto

Legacy mode(Deprecated)

We kept this feature for


backward compatibility and will stop providing it in the near future.

For On-


Demand Jobs

For on-demand jobs, just add the --result option to the td query command. After the job is finished, the results are sent to the specified FTP server.

Code Block
$ td query \
  --result '' \
  -w -d testdb \
  "SELECT code, COUNT(1) AS cnt FROM www_access GROUP BY code"

If a port number is not specified, the default value is 21.

The request body is in CSV format (RFC 4180) where the first line is a header with the column names, the new line is CRLF, the text encoding is UTF-8, and the quotation character is double quotes-quoted.

Code Block
c," d "