Python Script (Hive)

This Node Is Deprecated — This node is kept for backwards-compatibility, but the usage in new workflows is no longer recommended. The documentation below might contain more information.

This node is part of the deprecated database framework. For more information on how to migrate to the new database framework see the migration section of the database documentation.

Allows execution of a Python script in a local Python installation. The path to the Python executable has to be configured in Preferences → KNIME → Python.

NOTICE: The nodes uses the JayDeBeApi library to establish a connection to the database via a JDBC connection which his included. However to use JayDeBeApi JPype needs to be installed. For Windows precompiled libraries can be download from Unofficial Windows Binaries for Python Extension Packages.

Options

Script

Target folder
A folder on the server where the temporary copy of the data is copied. The Hive server user needs read access to this folder.
Editor
The script that will be executed to generate this nodes output. Execute script will execute the full script while execute selection will only execute the currently selected script.

The editor optionally provides autocompletion (CTRL + Space) if the Python module jedi is installed.
Flow variables
The list contains the available flow variables. A double click will insert the corresponding identifier at the current cursor position in the editor.
Workspace
Lists the currently defined identifiers in the running Python instance. Reset workspace will remove all definitions and reinsert only the input data.

The result of the input database query is available via the db_util object. For details about the available functions of the db_util object execute db_util.print_description() in the editor.
Console
Displays the standard and error output of the execution as well as other relevant information.

Templates

Create from editor...
Create a new template based on the script contained in the editor of the script tab.

Note: User defined templates can be found in the folder: knime-workspace/.metadata/knime/sourcecode-templates/python-script
Remove selected
Removes the selected template.

Note: Templates provided by plugins can not be removed.
Apply selected
Replaces the script contained in the editor of the script tab with the selected template.

Input Ports

Icon
A connection to the remote Hive server
Icon
The input database connection that defines the input table. In the Python script it is available as DBUtil under the name db_util.

Output Ports

Icon
A database connection with the result table. The result table is either automatically defined by the DBUtil class or by the user by executing the db_util.set_output_query() method.

Views

Standard output
The text sent by Python to the standard output, during the execution of this node.
Error output
The text sent by Python to the error output, during the execution of this node.

Workflows

  • No workflows found

Links

Developers

You want to see the source code for this node? Click the following button and we’ll use our super-powers to find it for you.