Deepthi
Deepthi

Reputation: 79

Mongodb input in pentaho

I have a time field in mysql table. based on this time field I need to import data from mongodb collection. So in Pentaho transformations first I have a Table Input step which gets the required date. Next I have a mongodb input step.Here how do i filter records based on the output from previous step?

I saw that in mongodb input query it accepts parameters only if its an environment variable or defined in another transformation, but does not recognize variable from previous step. How do I load from previous step, please help me I am a fresher in Pentaho and trying for this solution since a week.

Thank you, Deepthi

Upvotes: 1

Views: 4583

Answers (3)

Syed Abdul Kather
Syed Abdul Kather

Reputation: 618

It can be achieved vai passing query as parameter. In Transformation setting Add a parameter (eg : MONGO_QRY )

Example

In MongoDB Query expression (json)

${MONGO_QRY}

It works fine for us try that . If not lets know .

Upvotes: 0

Codek
Codek

Reputation: 5164

Take a look at optiq. This is bleeding edge, but allows sql access to mongodb, so in theory you could use it in a table input step rather than a mongo input step:

http://julianhyde.blogspot.co.uk/2013/06/efficient-sql-queries-on-mongodb.html

Upvotes: 0

Gordon Seidoh Worley
Gordon Seidoh Worley

Reputation: 8088

You've already answered your own question:

I saw that in mongodb input query it accepts parameters only if its an environment variable or defined in another transformation, but does not recognize variable from previous step. How do I load from previous step, please help me I am a fresher in Pentaho and trying for this solution since a week.

If there is no way for a step to accept an input stream, you'll have to do exactly what you describe. In one transformation, access the MySQL table to get the time and store it in a variable. Then in another transformation access that variable in your MongoDB step.

Note that you will have to do this in two transformations to ensure that the variable is set by the time the MongoDB step runs.

Upvotes: 1

Related Questions