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

Scripting API Reference (knime.scripting.io) ​

The knime.scripting.io module is the primary API for interacting with KNIME data inside Python Script and Python View nodes. It is automatically available on the PYTHONPATH — you do not need to install it.

For the full API reference, see Python Scripting API.

Import ​

python
import knime.scripting.io as knio

Tables ​

SymbolDescription
knio.input_tables[i]Read-only input table at port index i (0-based).
knio.output_tables[i]Assign a knio.Table or knio.BatchOutputTable to write output.
knio.Table.from_pandas(df)Create a KNIME table from a Pandas DataFrame.
knio.Table.from_pyarrow(table)Create a KNIME table from a PyArrow Table.
table.to_pandas()Convert to Pandas DataFrame.
table.to_pyarrow()Convert to PyArrow Table.

Batches ​

SymbolDescription
knio.BatchOutputTable.create()Create an empty batch output table.
input_table.batches()Returns an iterable of batches. Each batch supports .to_pandas() / .to_pyarrow().
batch_output.append(data)Append a Pandas DataFrame or PyArrow Table as a batch.

Objects and images ​

SymbolDescription
knio.input_objects[i]Pickled input object at port index i.
knio.output_objects[i]Assign a picklable object to write output.
knio.output_images[i]Assign an SVG string or PNG bytes to write an image.

Flow variables ​

SymbolDescription
knio.flow_variables['name']Read or write flow variables as a dictionary.

Views (Python View node only) ​

SymbolDescription
knio.output_viewAssign the return value of a knio.view_* function.
knio.view(obj)Auto-detect format and create a view.
knio.view_html(html)View from an HTML string.
knio.view_svg(svg)View from an SVG string.
knio.view_png(data)View from PNG bytes.
knio.view_jpeg(data)View from JPEG bytes.
knio.view_matplotlib(fig?)View from an active or given matplotlib figure.
knio.view_seaborn(fig?)View from an active or given seaborn figure.
knio.view_plotly(fig)View from a Plotly figure. Set custom_data to Row ID for selection sync.
knio.view_ipy_repr(obj)View from an object with an IPython _repr*_ function.

Example: matplotlib ​

python
import knime.scripting.io as knio
import matplotlib.pyplot as plt

fig, ax = plt.subplots()
ax.plot([1, 2, 3], [4, 5, 6])

knio.output_view = knio.view_matplotlib(fig)

Example: Plotly with selection sync ​

To synchronize row selection between a Plotly chart and other KNIME views, set custom_data to the row index:

python
import knime.scripting.io as knio
import plotly.express as px

df = knio.input_tables[0].to_pandas()

fig = px.scatter(
    df,
    x="my_x_col",
    y="my_y_col",
    color="my_label_col",
    custom_data=[df.index],
)

knio.output_view = knio.view_plotly(fig)

Output images from views ​

The optional image output port is populated automatically when the view is SVG, PNG, or JPEG, or can be converted to one:

  • matplotlib / seaborn: PNG or SVG depending on the format argument.
  • Plotly: requires the kaleido package.
  • IPython objects: uses repr_svg, repr_png, or repr_jpeg (first available).
  • HTML: set an image representation manually via the view_html call.

You can also populate knio.output_images[0] directly:

python
import knime.scripting.io as knio
import matplotlib.pyplot as plt
import io

fig, ax = plt.subplots()
ax.bar(["A", "B"], [3, 5])

buf = io.BytesIO()
fig.savefig(buf, format="png")
knio.output_images[0] = buf.getvalue()

Jupyter notebook support ​

SymbolDescription
knime.scripting.jupyter.load_notebook(dir, name)Load a notebook as a Python module.
knime.scripting.jupyter.print_notebook(dir, name)Print cell contents to console.

Next steps ​

  • Bundled packages list
  • Troubleshooting
Pager
Previous pagePython Environments on Executors
Next pageBundled Packages