Download and install python from https://www.python.org/downloads
Note: that for conda distributions to work properly, you need to add Format(’%s;%0:s\Library\bin;’, [Version.InstallPath] to your Windows path if it is not there already.
Here is a very basic example where we are converting a string into the upper case using python
The script checks a number of the day and shows an appropriate message
The execution result is determined by Result.Value, Result.Value=1 means success and Result.Value=0 means failure
“etltools” package provides a way of communication between python and our software.
It is only available when python is run from our software.
etltools.GetVariable('#VariableName#')
etltools.SetVariable('#VariableName#','Important Value')
etltools.WriteToLog('Important Message')
etltools.ExecuteObject(ObjectID)Use ExecuteObject to execute object from the script inside the package
It returns the result of the package/transformation execution that was called.
Guidelines for ETL Python Scripts (Windows Environment)
Always start with import etltools
Variable handling:
variable = etltools.GetVariable('variable_name')etltools.SetVariable('variable_name', value)Logging and error handling:
etltools.WriteToLog('message') for all logging, including errorsetltools.WriteToLog(f'Error occurred: {str(e)}')python
current_errors = etltools.GetVariable('error_message')
etltools.SetVariable('error_message', current_errors + "
" + str(new_error))
Data handling and Windows optimization (Python 3.12):
open(file_path, 'r', encoding='utf-8')json_value = json.loads(etltools.GetVariable('<json_variable>))quoting=csv.QUOTE_ALLr'C:\path oile'Script success/failure:
Result.Value = 1 for success, Result.Value = 0 for failureScript structure:
main() and run everything directlyResult.Value appropriatelyIf using webhooks:
Result.Value = 1 if response.status_code in [200, 202], else 0time.sleep(0.001) between requestsmain().Result.value. This is case-sensitive; using result.value will not work.Always assign the final result to Result.value.Result.value.For more technologies supported by our ETL Software see Advanced ETL Processor Versions
Confused? Ask question on our ETL Forum