Uploading a mondrian schema to Pentaho using PDI

Francesco Corti

In this post is shared the solution to upload a mondrian schema to Pentaho BA Server, using the REST API through a transformation of PDI. If you take a look to this thread of the Pentaho forum, the goal seems to be a common problem so we think it could be a good idea to share the solution with the community. I hope this post will be helpful.

Development environment

The source code is developed and tested on a Windows platform and a Linux Ubuntu 14.04 LTS platform. Pentaho BA Server and Pentaho Data Integration are both in the 5.2 version.

Use case

Starting from a file containing the mondrian schema (a XML file), our goal is to develop a PDI transformation to define a Pentaho BA Server Data Source. Of course we would like to define the data source on the mondrian schema so we would like to define a so called “Analysis Data Source”.

The strategy

Thank to the Pentaho BA Server REST API, our strategy is to use the service described below to create the data source.

To create (and replace) an Analysis Data Source it’s easy: simply invoke a POST call to the REST, using a multipart request. Of course this goal could be easy using a programming language, but we would like to use a transformation of Pentaho Data Integration (called Kettle). Unfortunately Kettle is not so smart when you have a multipart request.

Description of the solution

Below is described the transformation of Pentaho Data Integration.

As you can imagine, the core of the solution is in the ‘Generate multipart entity’ step and in the ‘HTTP Post’ step. But before looking at this, let’s share what is in the ‘Generate rows’ step. There you are going to find the basic parameters to make everything properly work.

uploadAnalysis contains the file name with the mondrian schema. In the ‘Add root file’ step, this file name will be completed with the absolute path.

catalogName and origCatalogName contains the name of the mondrian schema (the same that is described in the XM file).

parameters… ok, it’s clear! 😉

Below the source code of the ‘Generate multipart entity’ step that defines three output parameters.

requestEntityValue containing the multipart entity to post in the request.

contentType and contentLength containing the informations about the request entity.

Conclusion

In this post, gently developed by Stefano Massarini, is shared the solution to upload a mondrian schema to Pentaho BA Server, using the REST API through a transformation of PDI. If you would like to use the solution and evaluate it, you can download it here.

Uploading a mondrian schema to Pentaho using PDI
last update: 2014-12-11T09:00:46+00:00
by Francesco Corti

2 thoughts on “Uploading a mondrian schema to Pentaho using PDI”

Hi Francesco,
Thank you for your good blog article!
I tried to change your code for repository API “/pentaho/api/repo/files/import”.
I could send a text file, but I could not send a binary file.
Do you know how to send binary files?

Hi Teruo,
Your goal is quite different from the purpose of this post but I should have the solution because I needed to upload a generic file into the repository.
If you want to see a working transformation you can take a look at “Create target folder and upload file” in the AAAR_Kettle repository of the AAAR project you can see and install here:http://fcorti.com/alfresco-audit-analysis-reporting/aaar-how-to-install/aaar-get/
I hope this helps you.