0

I need :

  • 1) Let the user select a file from his local pc
  • 2) Upload that file to the pentaho server
  • 3) Process the file using a kettle transformation

I tried with a csv data source in Pentaho User Console (PUC) 5.0 but found no way to access it from a .ktr file uploaded to PUC repository. I also try to upload the csv file to a folder and still not able to access it from a .ktr file.

JRichardsz
  • 14,356
  • 6
  • 59
  • 94
Dino
  • 781
  • 3
  • 14
  • 32
  • Theres no use of uploading ktr files to PUC. They should be uploaded to DI Repository. What is your requirement? – Marlon Abeykoon Jun 23 '15 at 17:32
  • Is DI repository available for community edition? My requirement is to upload a csv data file and .ktr file to PUC folder. The .ktr should be able to read the uploaded csv file when it is executed from PUC. That's all. – Dino Jun 23 '15 at 18:10
  • from my knowledge you cant execute a uploaded ktr in PUC. You can read a ktr from a prpt and get data from a csv. csv is not necessary to be in PUC. Ktr also is not needed to upload to DIserver unless you dont schedule. – Marlon Abeykoon Jun 23 '15 at 18:18
  • Hi Marlon, it can... it just executed in the background. See some examples in the PUC folders. – Dino Jun 23 '15 at 18:33
  • Hi @MarlonAbeykoon. Currently, there are several ways to invoke ktr or jkb from PUC : (1)schedule using xaction or directly a .ktr / .jkb (2) CDE, etc. – JRichardsz Jan 15 '18 at 19:29

1 Answers1

2

I think this requirement is valid :

Upload a csv data file and .ktr file to PUC folder. The .ktr should be able to read the uploaded csv file when it is executed from PUC

Imagine a simple user, with a csv. Will he be able to upload csv file to linux host using wincsp, filezilla or another ftp tool??

We need to give an easy upload functionality to our user, so after several researching hours (pentaho source code) without one line of Pentaho documentation, I found this test:

https://github.com/pentaho/pentaho-platform/blob/master/extensions/src/test/java/org/pentaho/platform/plugin/services/importer/PlatformImporterTest.java that showed me that a mimetype list should be exist somewhere.

So after search some words in all pentaho folder wiht grep command, I found this file:

/my_apps/pentaho-server-ce-7.1.0.0-12/pentaho-server/pentaho-solutions/system/ImportHandlerMimeTypeDefinitions.xml

With some intuition, I added this xml

<ImportHandler class="org.pentaho.platform.plugin.services.importer.RepositoryFileImportFileHandler">
  <MimeTypeDefinitions>
    <MimeTypeDefinition mimeType="text/plain" >
      <extension>csv</extension>
    </MimeTypeDefinition>
  </MimeTypeDefinitions>
</ImportHandler>

At the bottom of file:

<tns:ImportHandlerMimeTypeDefinitions xmlns:tns="http://www.pentaho.com/schema/" .....
   <ImportHandler ../>
   <ImportHandler ../>
   <!-- PUT CSV CONFIG HERE -->    
</tns:ImportHandlerMimeTypeDefinitions>

Finally, I restarted my pentaho-server-ce-7.1.0.0-12 server and I was able to upload my csv file with this steps :

enter image description here

Read this csv file from ktr is pending...

I hope this helps

JRichardsz
  • 14,356
  • 6
  • 59
  • 94