cancel
Showing results for 
Search instead for 
Did you mean: 

import sapdi library in python operator of SAP DI

0 Kudos
778

Hello, community

I was trying to import the sapdi python library inside a python operator on the pipeline so as to create and run a pipeline from the existing pipeline I which I have the python operator. the issue over here I that I'm not able to import sapdi in the python operator also tried installing the library on the docker image.

any help would be appreciated!

Thankyou.

Accepted Solutions (1)

Accepted Solutions (1)

architectSAP
Active Contributor

Hello Aditya,

To use the Python SDK you have to base your Python operator on the $com.sap.sles.ml.python Docker File. For convenience I built my own Docker File based on $com.sap.sles.ml.python and just add an sapdi Tag:

In my Python Operator I can then just add the sapdi Tag to import the Python SDK:

With that I can e.g. access my Data Collection as in Build your first SAP Data Intelligence ML Scenario with TensorFlow:

import pandas as pd
import sapdi
ws = sapdi.get_workspace(name='architectSAP')
dc = ws.get_datacollection(name='architectSAP')
with dc.open('RunningTimes.csv').get_reader() as reader:
    df = pd.read_csv(reader, sep=';')

Hello frank.schuler,

I tried out your solution and it is working alright.

Thank you very much! 🙂

architectSAP
Active Contributor
0 Kudos

Thank you, Aditya.

I did some more research and found an even easier solution to use the Python SDK without requiring a custom Docker File:

Access SAP Data Intelligence Machine Learning with the Python SDK | SAP Blogs

As it turned out, just adding the sapdi Tag is sufficient and draws Docker Image com.sap.dsp.linuxx86_64/dsp-core-operators-docker.

Best regards

Answers (0)