Python-engine¶
This plugin allows execution of Python code on streamed data using the GraalVM Python engine.
Python API¶
The Python code can access the input data passed to the resource.
The Python code should define a function named process that takes the input data and returns the output data:
def process(input):
# ...
return output
To read or write stage-scoped values via the stash, define process_with_context instead; it receives the
stash context as a second argument:
def process_with_context(input, context):
context.stash("key", input)
return context.get("other")
Security Considerations¶
The Python resource runs with limited permissions by default. In this configuration, it is granted access to public Java methods and fields, allowing interaction with host objects such as calling methods like Map.get() or accessing simple properties.
.configureResource(PythonResourceConfigBuilder.builder()
)
resource:
python-engine:
Java dependency management¶
Add this declaration to your dependency management system to access the configuration DSL for this plugin in Java.
<dependency>
<groupId>org.voltdb</groupId>
<artifactId>volt-stream-plugin-python-api</artifactId>
<version>1.8.0</version>
</dependency>
implementation group: 'org.voltdb', name: 'volt-stream-plugin-python-api', version: '1.8.0'
JSON Schema¶
You can validate or explore the configuration using its JSON Schema.