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

Inputs and outputs ​

These properties retrieve data from or pass data back to KNIME Analytics Platform. The length of the input and output lists depends on the number of input and output ports of the node.

Example: If you have a Python Script node with two input tables and one input object, access them via knime.scripting.io.input_tables[0], knime.scripting.io.input_tables[1], and knime.scripting.io.input_objects[0].

attribute knime.scripting.io.flow_variables : Dict[str, Any] ​

A dictionary of flow variables provided by the KNIME workflow. New flow variables can be added to the output of the node by adding them to the dictionary. Supported flow variable types are numbers, strings, booleans and lists thereof.

attribute knime.scripting.io.input_objects : List ​

A list of input objects of this script node using zero-based indices. This list has a fixed size, which is determined by the number of input object ports configured for this node. Input objects are Python objects that are passed in from another Python script node'soutput_object port. This can, for instance, be used to pass trained models between Python nodes. If no input is given, the list exists but is empty.

attribute knime.scripting.io.input_tables : List[Table] ​

The input tables of this script node. This list has a fixed size, which is determined by the number of input table ports configured for this node. Tables are available in the same order as the port connectors are displayed alongside the node (from top to bottom), using zero-based indexing. If no input is given, the list exists but is empty.

attribute knime.scripting.io.output_images : List ​

The output images of this script node. This list has a fixed size, which is determined by the number of output images configured for this node. The value passed to the output port should be a bytes-like object encoding an SVG or PNG image.

Examples ​
python
>>> import knime.scripting.io as knio
...
... data = knio.input_tables[0].to_pandas()
... buffer = io.BytesIO()
...
... pyplot.figure()
... pyplot.plot('x', 'y', data=data)
... pyplot.savefig(buffer, format='svg')
...
... knio.output_images[0] = buffer.getvalue()

attribute knime.scripting.io.output_objects : List ​

The output objects of this script node. This list has a fixed size, which is determined by the number of output object ports configured for this node. Each output object can be an arbitrary Python object as long as it can be pickled. Use this to, for example, pass a trained model to another Python script node.

Examples ​
python
>>> model = torchvision.models.resnet18()
... ...
... # train/finetune model
... ...
... knime.scripting.io.output_objects[0] = model

attribute knime.scripting.io.output_tables : List[Union[Table, BatchOutputTable]] ​

The output tables of this script node. This list has a fixed size, which is determined by the number of output table ports configured for this node. You should assign a Table or BatchOutputTable to each output port of this node.

Examples ​
python
>>> import knime.scripting.io as knio
... knio.output_tables[0] = knio.Table.from_pandas(my_pandas_df)

attribute knime.scripting.io.output_view : Optional[NodeView] ​

The output view of the script node. This variable must be populated with a NodeView when using the Python View node. Views can be created by calling the view(obj) method with a viewable object. See the documentation of view(obj) to understand how views are created from different kinds of objects.

Examples ​
python
>>> import knime.scripting.io as knio
... import plotly.express as px
...
... fig = px.scatter(x=data_x, y=data_y)
... knio.output_view = knio.view(fig)
Pager
Previous pageAPI Reference
Next pageClasses