Icon

2. Write to a Database

<p><strong>Write to a Database</strong></p><p>This workflow shows how to write a data table into a database. In particular, we use the SQLite database here because it is file-based and does not require additional installation.</p><p>This workflow also shows how to performs different kinds of string manipulations and type conversions. To do so, we use the <em>Expression </em>node which allows performing various string, logic, and math operations</p><p><strong><em>Note.</em></strong> This workflow has to be executed <strong>BEFORE </strong>executing the workflow "3. My first Data Exploration".</p>

URL: KNIME Beginner's Luck (Book Homepage) https://www.knime.com/knimepress/beginners-luck

Annotations and comments
  • Workflow: Write to a Database This workflow shows how to write a data table into a database. In particular, we use the SQLite database here because it is file-based and does not require additional installation. This workflow also shows how to performs different kinds of string manipulations and type conversions. To do so, we use the Expression node which allows performing various string, logic, and math operations Note. This workflow has to be executed BEFORE executing the workflow "3. My first Data Exploration".
  • String splitting
  • String replacement
  • Write data to SQLite Database Use the SQLite Connector node to connect to the SQLite database. Note that SQLite is a file-based database. The SQLite Connector node thus requires the path of the database file. It also supports the knime:// protocol. The SQLite driver is already included in the SQLite Connector node. Drivers of most popular databases are included in database connector nodes for databases' most recent versions. Then, connect a DB Writer node to the SQLite Connector node to actually write the data into a new table.
  • Joining strings
  • Type Conversion
  • iris.csv path relative to "current workflow"
  • Split "class" in iris & <attr> by delimiter "-" <attr> = Setosa/Virginica/Versicolor
  • Split "petal width" into integer & floating by using "." as the delimiter
  • Split "class" in iris & <attr> by position <attr> = Setosa/Virginica/Versicolor
  • Combine <attr> and "IRIS" into <attr>:IRIS
  • Rearrange column order for next node
  • write output data table into SQLite database
  • Transform Double to Integer
  • Add new column "class nr"
  • Replace all "Iris" with "IRIS"
  • Convert "class_Arr[0]" to UPPERCASE
  • Build <attr>: "IRIS"
  • "petal width" from Double to String
  • Split "class" in iris & <attr> by regex <attr> = Setosa/Virginica/Versicolor
  • KBLBook2.sqlite connect to SQLite database knime:// protocol supported
  • Replace all Ir* with IRIS
  • Transform String back to numbers

Nodes

Extensions

Links