Creating KNIME Nodes from External SQL Scripts Using Python

Hello KNIME Community,

I have a question regarding the possibility of creating KNIME workflow nodes outside of KNIME Analytics Platform. My use case is as follows:

  • I have multiple SQL scripts that I would like to use as individual steps in a KNIME workflow.
  • I work primarily in Python and would like to automate the transformation of these SQL scripts into corresponding KNIME nodes.
  • Ideally, I would like to generate these nodes programmatically and integrate them into KNIME without manually configuring each one inside the Analytics Platform.

Is there a way to achieve this?
Would KNIME’s API or extensions allow me to create, import, and execute such nodes dynamically?
Any guidance, references, or examples on how to approach this would be greatly appreciated!

Thanks in advance for your help.

Zoe

Hi @zoekolan ,

welcome to the KNIME forum.
You can develop KNIME nodes in Python as described here.

If you only want to make SQL scripts reusable – skipping the Python coding – you can use one of KNIME’s SQL nodes, e.g., DB SQL Executor – KNIME Community Hub or DB Query – KNIME Community Hub. Then, wrap the node in a component, which you can share and reuse.

Have a nice day,
nan

1 Like

Thank you for the quick response!

However, I’m not sure this fully answers my question. My goal is specifically to avoid using the visual platform manually, as recreating all the SQL nodes by hand would be too time-consuming.

What I am looking for is a way to automate the generation of SQL nodes directly from my external Python script. Instead of manually dragging and configuring each node in KNIME, I’d like to programmatically generate them and feed them my SQL scripts.

From what I understand, creating a new KNIME extension in Python wouldn’t help with this, as it seems more suited for developing entirely new node types rather than dynamically generating workflow components. (Please correct me if I’m wrong :slight_smile: )

Is there a way to programmatically create workflows and nodes from an external Python script and import them into KNIME?

Thanks again for your insights!

Indeed, I misunderstood your question.
At the moment, there is no intended way to build workflows programmatically.

If you wanted to, you could build a template workflow once and use Python to copy that template and replace the placeholder SQL in the configuration file of the SQL node. However, this could go wrong quite badly and will fail as soon as we change the way workflows are stored on disk. If you are really adventurous, you could try it out for a one-off migration project. I definitely do not recommend this if you are looking for something stable and long term.

1 Like

Thank you very much for your honest feedback and for taking the time to clarify

I understand the risks involved in modifying workflow files directly, especially given that KNIME’s storage structure might change in future updates.

That being said, my goal here is strictly for a one-off migration project—I’m just looking for a way to efficiently convert existing SQL scripts into KNIME workflows without having to rebuild everything manually.

Once the migration is done, the idea is to use KNIME in the standard way, but this approach would help make the transition faster and smoother. Given the temporary nature of this, I might give it a try and see if it works well enough for this purpose.

Really appreciate your insights, thank you again!