Search This Blog

Friday, 16 August 2013

Update Without Update Strategy

Suppose if we have requirement to implement the update rows without using update strategy transformation. May be few rows will be updated in this requirement. To improve the performance of ETL, is there any other way?

One way is to use the Lookup transformation to identify which row is to be inserted or updated, by comparing with the target table data in lookup cache. This also has drawback, what if the lookup cache increases in future. This may not be good idea.

Using the session properties "Treat source rows As". Here will explain about with illustration.

During session configuration, you can select a single database operation for all rows using the Treat Source Rows As setting from the 'Properties' tab of the session.

  • Insert :- Treat all rows as inserts. 
  • Delete :- Treat all rows as deletes.
  • Update :- Treat all rows as updates. 
  • Data Driven :- Integration Service follows instructions coded into Update Strategy flag rows for insert, delete, update, or reject. 

Specifying Operations for Individual Target Rows

Once you determine how to treat all rows in the session, you can also set options for individual rows, which gives additional control over how each rows behaves. Define these options in the Transformations view on Mapping tab of the session properties. 

  • Insert :- Select this option to insert a row into a target table. 
  • Delete :- Select this option to delete a row from a table. 
  • Update :- You have the following options in this situation: 
    • Update as Update :- Update each row flagged for update if it exists in the target table. 
    • Update as Insert :- Insert each row flagged for update. 
      • Update else Insert :- Update the row if it exists. Otherwise, insert it. 
  • Truncate Table :- Select this option to truncate the target table before loading data.

Implementation

Now we understand the properties we need to use for our design implementation.We can create the mapping just like an 'INSERT' only mapping, with out LookUp, Update Strategy Transformation. During the session configuration lets set up the session properties such that the session will have the capability to both insert and update.

First set Treat Source Rows As property as shown in below image.


Now lets set the properties for the target table as shown below.  Choose the properties Insert and Update else Insert.


Thats all we need to set up the session for update and insert with out update strategy.

1 comment:

  1. I would like to thank you for the efforts you have made in writing this Article. ETL Testing Online Training

    ReplyDelete