Python as a scripting language
It is, however, possible to use Python instead.
Etlworks Integrator includes a library Jython, which adds Python to the list of supported scripting languages.
Currently, Jython supports Python 2.7 and does not support loading third-party packages.
Availability of Python in Etlworks
Python is available in the following places:
- In Mapping to calculate the field's value.
- In scripting transformations (before/after/for each row).
- When configuring conditions and loop conditions in Nested flow.
How to write scripts in Python
Step 1. Everywhere where there is a scripting text area, click the
Open in Editor button.
Step 2. Click
Select Language and choose
Step 3. Write code in Python.
How to import Java classes and packages into the Python script
To access the classes provided by the Etlworks Java API, you need to import a particular package and class. It is possible to import multiple packages and classes into the same Python program.
from org.jsoup import Jsoup
from com.toolsverse.etl.core.task.common import FileManagerTask
from com.toolsverse.util import TypedKeyValue, Utils
from java.util import ArrayList
// the rest of the code
How to return a value from the Python script
If the Python code needs to return a value, for example, when calculating a field's value on the fly or setting the loop conditions, call
if evals < files.size():
fileFrom = files.get(evals).getKey()
fileTo = files.get(evals).getValue() + '.xlsx'
value variable can be used as a return value.