DB Writer

Inserts data rows into the database based on the selected columns from the input table.

If the database table does not exist it will be created by the node prior inserting the values. The new table will have a column for each input KNIME column. The database column name will be the same as the name of the input KNIME column. The database type is derived from the given KNIME type based on the output type mapping rules specified in the "Output Type Mapping" tab. All database columns will allow missing values (NULL). Please use the DB Table Creator node if you want to control the properties of the created database table.

If the table already exists in the database all selected column names need to exactly match the column names within the database table.

The output table contains two additional columns if the Append insert statuses checkbox is checked. The first extra column is the number of rows affected by the INSERT statement. A number greater than or equal to zero -- indicates that the was processed successfully and is an insert count giving the number of rows in the database that were affected by the command's execution A value of -2 -- indicates that the command was processed successfully but that the number of rows affected is unknown. The second shows a warning message, if any.

Options

Settings

Table to write
Click Select a table to select the table to write to or create in the pop up dialog, or enter a valid Schema and Table name into the input fields.
Batch size
Enter a number greater than 0 for the number of rows updated in one batch job. Entering 1 disables batch processing. This way only one row is processed at a time.
Fail on error
Disable this option if you want to continue after a database error.
Append write status columns
Enable this option to append two additional (status and error) columns to the output table (see description).
Disable DB Data output port
Select this option to disable the DB Data output port and the execution of the metadata query at the end of the node execution which might cause problems with databases that do not support subqueries.
Remove existing table
Enable this option to remove any table with the given name from the database. This is usually done by executing the SQL command drop. If this option is not selected the data rows will be appended to an existing table.
Select the columns to write (SET in SQL)
Select the columns to write into the database. The column names in the KNIME input table need to match the column names in corresponding database table. In SQL this is equivalent to the SET columns.

Output Type Mapping

This tab allows you to define rules to map from KNIME types to database types.

Mapping by Name
Columns that match the given name (or regular expression) and KNIME type will be mapped to the specified database type.
Mapping by Type
Columns that match the given KNIME type will be mapped to the specified database type.

Input Ports

Icon
KNIME data table with the data rows to write into the database.
Icon
DB Connection to connect to the database.

Output Ports

Icon
Input KNIME data table with additional columns providing the number of affected rows in the database and warnings, if checked in the dialog.
Icon
DB Data referencing the selected table.

Popular Successors

Views

This node has no views

Workflows

Links

Developers

You want to see the source code for this node? Click the following button and we’ll use our super-powers to find it for you.