Skip to Content

SAP Data Services and Python - how to install a library? (PIP missing?)

Hello,

Love the fact that python is available in SAP Data Services.

But does anybody know how to add python libs to data services.

In a normal python environment this would be done by a 'pip isntall…'

But with data services is less clear (Where is pip??) :(

Python is a powerful addon to the tool.

But without the possibility to add the vast availability of Python libs it loses a lot of power.

Many thanks for the help!

Regards,

Steven Dauw

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Jan 16 at 10:21 AM

    Hi, Steven.

    You can use User_Defined Transform in Data Services for this purpose.

    You can use classes and functions from custom python module in the following way:

    1. Install python library locally using pip.
    2. Put library to the file server at an accessible location.
    3. Use this library in python script.

    Note: When you import library, that was put to the file server, don't forget add to sys.path relative to the current running script.

    import sys
    import os
    sys.path.insert(0, os.path.dirname(__file__))

    4. Insert User_Defined Transform in BODS Job and import your python script using "imp" module and use classes and functions from your custom script.

    import imp
    myscript = imp.load_source('myscript', '//job_server/lib_path/myscript.py')
    myscript.myFunction()
    Add comment
    10|10000 characters needed characters exceeded