Skip to content
KNIME Documentation
Main Navigation Get startedBuildWork with KnimeAccount and adminRelease notesDeveloper tools
Community Hub
DevelopersKnime
Sidebar Navigation

Getting Started

Installation

User Guide

Release Notes

Install Extensions

Building Workflows

Components

Flow Control

Expressions

File Handling

Deployment

Integrated Deployment

Workflow Invocation

Best Practices

Advanced Features

AI Extension

Get Started

Build an Agent

Inject context with RAG

LLM Providers

Tutorials

Summarize product reviews

Product FAQ assistant

Restaurant agent

Your first local agent

Task extractor

Reporting

Kerberos

Extensions

Database

Overview

Tutorials

Read and filter data from a database

Write a transformed dataset to a database

Concepts

Ports and Sessions

Query Generation

Type Mapping

Deprecated Framework

Connecting

Connect: Dedicated Node

Connect: File-Based Database

Connect: Generic DB Connector

Register a JDBC Driver

Install Third-Party Driver Plug-in

Drivers on Hub and Server

Kerberos Constrained Delegation

Reading and Transforming

Read Data

Transform Data Visually

Run a Custom SQL Query

Parameterize a Query

Writing and Modifying

Insert, Update, or Merge

Delete Rows

Bulk Load Data

Create and Remove Tables

Use Transactions

Reference

Connector Node Settings

JDBC Driver Reference

Deprecated Node Mapping

Migrate Deprecated Workflows

Python

Overview

Tutorials

Python Scripting Quickstart

Data App Development Using Plotly

Data Processing

K-AI Scripting Assistant

Data Type Conversion

Batch Processing

Jupyter Integration

Environment Management

Pixi Configuration

Dependency Management

Environment Persistence

Channel Mirrors & Air-Gapped Setups

Conda Migration

Alternative Configurations

Conda and Miniforge Setup

Conda Environment Propagation

Manual Python Configuration

Legacy Node Migration

Concepts

Pixi Backend Architecture

Storage Logic

Python Environments on Executors

Reference

Python Scripting API

Bundled Packages

Executor and Hub Configuration

Troubleshooting Guide

API Reference

Inputs and outputs

Classes

Views

Utility functions

R

Deep Learning

Snowflake

Google Cloud

Azure

AWS

Big Data

Big Data Admin

Big Data Secured Cluster

Databricks

Microsoft Fabric

Power BI

Tableau

Report Designer

H2O

Changelogs

Version 5.12

Version 5.11

Version 5.10

Version 5.9

Version 5.8

Version 5.7

Version 5.6

Version 5.5

Version 5.3

Extensions

Parameterize a SQL query ​

Use the DB Parameterized Query Reader or DB Looper node to execute SQL queries that take values from an input KNIME table — for example, to run a query once per row, or to filter with a dynamic list of values.

Before you begin ​

  • Establish a database connection. See Connect to a database using a dedicated connector node.
  • Prepare a KNIME data table whose column values supply the query parameters.

Execute a query once per input row with DB Parameterized Query Reader ​

The DB Parameterized Query Reader node loops over an input KNIME table and executes the SQL query once for each row, substituting column values as parameters.

  1. Connect the DB Connection output port to the DB Parameterized Query Reader node.
  2. Connect the KNIME data table with parameter values to the second input port.
  3. Click the node once to open a compact SQL editor, then click the expand icon to open the full configuration.
  4. Write your SQL statement, referencing input columns as parameters using the syntax defined in the node configuration.
  5. Under Output Options, configure how the result is built:
    • Append input columns — adds the input table's columns to the output.
    • Include empty results — keeps a row for input values whose query returns no data.
    • Retain all columns — keeps the union of columns across all query executions.
    • Fail on error — fails the node if a query execution returns an error.
  6. Click Show advanced settings to configure Input Type Mapping, if needed. See Type mapping.
  7. Click Apply to save the configuration, or Apply and Execute to save it and run the node.

Filter with a dynamic list using DB Looper ​

The DB Looper node executes a SQL query restricted by the values in an input KNIME table. It replaces a column placeholder $ in the query with a comma-separated list of values from the table.

Use it for IN queries where the list of values changes at runtime:

sql
SELECT * FROM table
WHERE Col1 IN ($)
  1. Connect the DB Connection output port to the DB Looper node.
  2. Connect the KNIME data table containing the filter values to the second input port.
  3. Click the node once to open a compact SQL editor, then click the expand icon to open the full configuration.
  4. Write your SQL query, using $ as the placeholder for the value list.
  5. Under Loop Settings, set No of values per query to the number of values to substitute per query execution, or tick Read all to substitute every value in a single query.
  6. Configure Aggregate by row, Append input columns, Include empty results, Retain all columns, and Fail on error as needed.
  7. Click Show advanced settings to configure Input Type Mapping, if needed.
  8. Click Apply to save the configuration, or Apply and Execute to save it and run the node.

An example workflow is available on KNIME Hub.

Next steps ​

  • Run a custom SQL query
  • Transform data visually in a database

Related pages ​

  • Query generation
  • Type mapping
Pager
Next pageInstallation