Working with the SAP Data Intelligence is great, especially because you can create your own operators, suited exactly for your use case. But every time when I worked with custom operators, I asked myself about how to versionise those operators, e.g. in git (stay tuned for a follow up article on working with git repos directly on the DI!). Or how to share them with colleagues or customers, working on different DI instances.
In this blog post I want to collect possible solutions for you to use to make exporting and importing operators from and to the DI an easy job.
I brought two options for you, one that I would not recommend, but will explain for the record, and one that I would definitively recommend and use every time. So let’s get started:
Option 1 (not recommended)
As you know, your operator consists of several parts you need to edit when you create the operator:
- Property Configuration
- Meta-Information like title, picture etc.
Some of these parts can be viewed as “json” within the SAP DI Modeler, e.g. the configuration or the meta-information part:
You can copy all those json files, together with the script and documentation, into files on your local machine. Typically, you would end up with four files:
- README.md / Documentation.txt
- script.py (if it’s a python opertor)
If you want to share your operator, you need to create a handbook in addition to those files, about how to put the files together to an operator again. This can be messy, especially when it should be done by people not so experienced with the SAP DI (see below).
Option 2 (recommended!)
As an alternative you can export the operator as “solution”, so everything you need will be included. You will download a zip file in the end that can be uploaded and used anytime.
To do this, go to “System Management” > “Files” > “My Workspace”. Then either search for the name of your operator or use this click path (when it is a python operator): “files” > “vflow” > “subengines” > “com” > “sap” > “python36” > “operators”.
Then, click on the three-dot-menu to select “Export as Solution”. You will be prompted with a pop-up, asking you to give information about your solution. This is only important to create the zip-file and will change nothing in the code of your operator. The download of your operator-zip-file will start as soon as you click on “Export as Solution”.
When you unpack this zip folder, you will see that it contains a file called manifest.json with the information you just gave before downloading, together with a folder, containing all the files that we mentioned earlier:
– Tip! –
You can also export single parts as files from the operator directly. For example, when you just want to export the content of the “configSchema.json” you can download it here, without the need to open the modeler and the operator modification. Or you can download all the content from option 1 from above, without the effort to click through the operator UI.
Now that you have your operators stored safely, you can versionise them (watch out for my follow up blog post about working with git on the DI!) or send them around to be imported (e.g. into a customers DI).
From Option 1 (again, not recommended)
In the DI Modeler, create a new operator. Use the exact name of the operator before, and then, step by step, give all information from the files you collected above:
- copy the content of configuration.json into the configuration json field (just as you exported it above)
- copy the content of operator.json into the overall json field (see also above how to find it)
- set the correct tags
- copy the content of script.py into the script section
- copy the content of README.md / Documentation.txt into the documentation section
I would recommend to write a detailed instruction document for your collegue / customer about how to do this best and where to look at for possible mistakes! This can be a very … annoying task.
Now: you can try the operator!
Sometimes, you might have problems when using files coming from an exported operator. One of the most frequent errors is the naming of the operator. When the operator was created with the technical name “python_conversion_operator”, then this (technical) name has to be used also for the “copy” that you are creating right now. There are references to the operator name in the json files that you just exported, and when there is a mismatch between the names, the operator won’t work.
From Option 2 (recommended)
To import any operator in your SAP Data Intelligence instance, navigate to “System Management” > “Files” > “Union View”. Then click on the “incoming arrow”-icon to open the import menu. When you select “Import Solution”, a file dialogue will open, where you can select your zip-file to be uploaded. Upload, and your operator should be imported at the correct location without any need to specify it (see above, location where e.g. python operators are stored).
And that’s it! When you are working at the modeler right now, you might need to refresh the list of operators so that the new operator can show up. But now, you can use your operator out of the box!
My learning from this research about importing and exporting operators: The most obvious and straight forward way is not always the best. Even if you are able to share operators within a compact list of files, the export via “System Management” as waaaaay more easy. I hope, that you can use my recommendations in your following projects!
Importing and exporting stuff from DI is fun! In my upcoming blog post I will show you how you can import and export graphs as well. Stay tuned!