Skip to main content

Export to CSV file

Run a SELECT or a stored procedure with ? parameters and write its rows to a CSV file without loading them into memory.

Command in the Database toolkit · id ooa.database/export_to_file · 13 inputs (1 required), 2 outputs

Inputs​

InputTypeRequiredDefaultWhat it is
SQL statementStringNoSELECT statement with ? placeholders (or use procedure).
PathFileYesCSV file to create.
ParametersListNoValues for the ? placeholders, in order.
DelimiterStringNo,Field separator, e.g. , or ; or tab.
First row is the headerBooleanNotrueWrite the column names as the first line.
EncodingStringNoutf-8Text encoding of the file.
SessionStringNodbSession name.
Query timeout (seconds)NumberNo0Cancel the statement after this many seconds; 0 waits as long as the step allows.
OverwriteBooleanNotrueReplace an existing file; when false an existing file stops the step.
ProcedureStringNoStored procedure whose first result set is written, used instead of sql; parameters are its input values in order.
Maximum rowsNumberNo0Stop after writing this many rows; 0 writes them all.
AppendBooleanNofalseG2 (AA parity): add the rows to the end of the file when it is there (without a second header line).
Skip when no rowsBooleanNofalseG2 (AA parity): make no file when the query gives no rows (path is then empty).

Outputs​

OutputTypeWhat it is
pathFileWritten file.
row_countNumberRows written.