Read data from a database
Read a database table or custom query result into a KNIME data table using the DB Table Selector and DB Reader nodes.
Before you begin
- Establish a database connection using a connector node. See Connect to a database using a dedicated connector node or Connect to a database with the generic DB Connector.
Select and read a table
Configure a DB Table Selector node to choose a table or query, then read the result with a DB Reader node.
- Connect the output port of the connector node to a DB Table Selector node.
- Click DB Table Selector once to open its configuration.
- Enter the Schema and Table/View name, or click Select a table to open the Database Metadata Browser and pick from a list of available tables and views.
- To write a custom SQL query instead, tick Custom Query and enter a
SELECTstatement. Use the placeholder#table#to reference the table selected via the browser. - Optionally, configure Input Type Mapping rules to override how database types map to KNIME types. See Type mapping.
- Click Apply.
- Connect a DB Reader node to the DB Table Selector output port.
- Execute the DB Reader node. It runs the SQL query in the database and outputs the result as a KNIME data table.
Use the Database Metadata Browser
The Database Metadata Browser displays the database schema, including all tables, views, and their columns with data types.
- Click a schema, table, or view to expand it.
- Select a table or view and click OK, or double-click it to confirm the selection.
- Use the search box at the top to find a table or view by name.
- Click the Refresh button (lower right) to reload the schema if changes have occurred since you opened the browser.