Question

I have three tables (Oracle source), lets call them tables 1, 2, and 3.

I would like to check a boolean field in table 1, and if it is T I want only data from table 2, and if it is F, I want only table 3.

Which transformation would be the most efficient for doing so, and how would I go about implementing it?

I'm experimenting with the Filter, Java, and Expression transformations, but if the expressions are checking on a row-by-row basis, then it seems like overkill for the expression to run on every row instead of just checking once and using the appropriate table.

Both tables 2 and 3 have a field with the same name, and I want that field for just one of the tables, based on the condition.

Was it helpful?

Solution

Create a mapping similar to the following diagram:

src_TABLE2 --> sq_TABLE2 --|
                           |--> union --> (further processing)
src_TABLE3 --> sq_TABLE3 --|

and use the following Source Filter conditions* in the source qualifiers:

-- for sq_TABLE2
'T' = ( SELECT FLAG FROM TABLE1 )

-- for sq_TABLE3
'F' = ( SELECT FLAG FROM TABLE1 )

There are two source tables in the mapping and the union transformation merges data from these two pipelines. However, because of the filtering conditions at any given time data will be retrieved only from one of the source tables.

* Source Filter is an attribute on the Properties tab of a source qualifier. The condition you set here is appended to the WHERE clause of the SELECT statement that is sent to the database.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top