Logan
Logan

Reputation: 2515

Pentaho step - Use SQL functions to add a column in data before dumping it int DB

I am fairly new to Pentaho, and while working on it, I have stumbled across a problem. Below is how my flow is:

  1. Read input from a file. Let's say this has 5 columns.
  2. Make some modifications to existing columns. (Filter, modify and all).
  3. Add a new column, which will be equal to an SQL function of the current row data. Example, it can be sum(id, id+1)
  4. Dump to the database.

Step 1,2, 4 are already in place and are working fine. It's Step 3 where I am stuck. I've tried to execute SQL, but that is only for Modifying DDL and doesn't return data. Table input needs data to be in a table already, which isn't the case with me.

I have a workaround, that I can enter all rows in DB, and then fire an update query, but I was hoping if there is a better way to do this.

Upvotes: 0

Views: 531

Answers (1)

Rakesh Chandru
Rakesh Chandru

Reputation: 95

You can add formula step and in the formula column, you can specify what you want to achieve. For example, your other column+1 and save it in a new field or also replace the existing field value

Upvotes: 0

Related Questions