nik
nik

Reputation: 11

Execute KNIME workflow with python in jupyter lab

I am trying to execute a simple KNIME workflow with python in jupyter lab and also looking to pass the filename for the KNIME workflow through python and to get the output on the jupyter lab.

I am able to get the KNIME workflow with:

knime.Workflow(workflow_path=workflow,workspace_path=workspace)

But it seems that data_table_inputs and data_table_outputs work with training models only. In this workflow screenshot, there is no training/container node:

test workflow

It's a very simple workflow which takes input file with reader node and applies some filters and generates the statistics. And I want to execute this workflow by passing filename from python code and generate the output on jupyter lab.

import pandas as pd
import matplotlib.pyplot as plt
import knime
knime.executable_path='/Applications/KNIME 5.1.1.app/Contents/MacOS/Knime'
workspace='/knimedir/knime-workspace'
workflow='testworflow'
knime.Workflow(workflow_path=workflow,workspace_path=workspace)

df=pd.read_csv("/knimedir/bankds.csv")

with knime.Workflow(workflow_path=workflow,workspace_path=workspace) as wf:
    wf.data_table_inputs[0]=df
    wf.execute()
wf.data_table_outputs[0]

Upvotes: 1

Views: 205

Answers (0)

Related Questions