Custom Python Node

I have created a Python Custom Node and works really well. Can you create a custom node that does not require an input table (or any input)? I am creating a node that just log into a portal and pass on a token.

Hi @vanzylkruger,
Welcome to the KNIME forum!
Yes, that works. Just remove all input port decorators and adapt the parameters of the configure and execute methods (You don’t even need an output port).

Example:

@knext.node(
    name="No Port Python Node",
    node_type=knext.NodeType.MANIPULATOR,
    icon_path="icon.png",
    category=node_category,
)
class NoPortNode:
    """No port node
    """

    def configure(self, config_ctx):
        return

    def execute(self, exec_context):
        exec_context.flow_variables["foo"] = "bar"
3 Likes

Thanks, that worked great. Is there only two types of @knext outputs e.g., binary and table. I need to pass a cookie onto the following node. Do I convert the cookie to a binary object and then the reverse when I use it.

Hi @vanzylkruger,
Yes. There are only table ports and binary ports for now. Therefore, you need to serialize everything that isn’t a table to a binary blob.

With the next release of KNIME AP, we will add API to define your custom port types. Stay tuned for that.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.