on 10-10-2018 1:45 PM
SAP BODS 4.2 SP 8 : how to execute a python script in a script
could anyone share some sample of how to execute .py python script within a bods script ?
need to execute a python script that inturn runs HIVE QL scripts for data load into HIVE.
Responses with detailed explanation appreciated since i am new to DS
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Joseph,
I am able to achieve this and below is the syntax to execute python Script from BODS Script
exec('ksh', '-c "sudo python3 path of the python script/file.py"', 😎
The Sudo - may or may not be required
Thanks
Madhu
If DS has built in Python, does that mean Python is already installed on the job server or would I need to install it myself - if so, would it need to be a specific Python version so I don't interfere with the existing UDT version?
If indeed it is possible, I would prefer to call Python via DS script and not through the UDT.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, srihari.
You can use User_Defined Transform in Data Services for this purpose.
You can execute your python script within BODS or use classes and functions from your custom python module in the following way:
import imp
myscript = imp.load_source('myscript', '//job_server/lib_path/myscript.py')
myscript.myFunction()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Use exec function to call the python script:
exec('E:\Python34\python.exe', '<ScriptLocation>\HIVEScript.py , '8');
The Python exe file path is relative to BODS server.
Regards,
Rishabh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
11 | |
10 | |
8 | |
8 | |
6 | |
6 | |
6 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.