Skip to main content

Bulk insert

Insert every row of a Data Table, or of a delimited text file read line by line, into a database table in batches, all or nothing.

Command in the Database toolkit · id ooa.database/bulk_insert · 12 inputs (1 required), 1 output

Inputs​

InputTypeRequiredDefaultWhat it is
TableStringYesDatabase table to insert into.
DataTableNoData Table whose rows are inserted (or use source_file).
ColumnsListNoDatabase column for each Data Table or file column, in order; the Data Table's column names (or the file's header) when empty.
Batch sizeNumberNo500Rows sent to the database per batch.
SessionStringNodbSession name.
Source fileFileNoDelimited text file (CSV) whose rows are inserted instead of a Data Table; it is read as it goes, so large files fit. Empty fields are inserted as NULL.
DelimiterStringNo,Field separator of the file: one character, or tab.
Start rowNumberNo1Line of the file where reading starts (1 = the first line); lines above it, such as a title, are skipped.
Has headerBooleanNotrueThe first line read holds the column names, used as database columns when columns is empty.
EncodingStringNoutf-8Text encoding of the file, e.g. utf-8 or windows-1252.
Column mapDictionaryNoG2 (AA parity): source column (Data Table or file header) to database column; columns left out are not inserted.
Timeout (seconds)NumberNo0G2 (AA parity): cancel a batch the database takes longer than this many seconds over; 0 waits as long as the step allows.

Outputs​

OutputTypeWhat it is
rows_insertedNumberRows inserted.