How to do a change capture for a Slowly Changing Dimension
Moderators: chulett, rschirm, roy
How to do a change capture for a Slowly Changing Dimension
Hello Team,
Can any one please resolve this issue?The scenario is
After:
Key,Value
ABC,10
ABC,10
Before:
Key,Value
ABC,20
O/P:
Key,Value,Change code
ABC,10,Update
ABC,10,Insert
Expectation is both after records are updates.
Am I missing any thing
Can any one please resolve this issue?The scenario is
After:
Key,Value
ABC,10
ABC,10
Before:
Key,Value
ABC,20
O/P:
Key,Value,Change code
ABC,10,Update
ABC,10,Insert
Expectation is both after records are updates.
Am I missing any thing
You didn't understand... How many rows with a key value of "ABC" do you have in your today input? If the answer is not one, then the change capture stage won't produce expected output.
If you have a scenario where yesterday is a "master" file and today contains multiple update transactions, the Merge stage might supply functionality you can use.
Mike
If you have a scenario where yesterday is a "master" file and today contains multiple update transactions, the Merge stage might supply functionality you can use.
Mike
Thanks alot Mike for quick response.
Our source is a transaction DB where I can get duplicate keys with same value and the fact information might vary based on quantity of the products bought by customers. We are using change capture to see if there is an update of insert. I believe Merge stage doesn't tell whether a record is an update or delete. So I am thinking to do remove duplicates on Key before applying change capture.
DB---> RemDup---> Change capture--> apply Type2 logic---> insert/updateDB
We know from requirements that we will get dups from source with same value but the fact Qty might change.
Am I on the right direction? Please suggest
Our source is a transaction DB where I can get duplicate keys with same value and the fact information might vary based on quantity of the products bought by customers. We are using change capture to see if there is an update of insert. I believe Merge stage doesn't tell whether a record is an update or delete. So I am thinking to do remove duplicates on Key before applying change capture.
DB---> RemDup---> Change capture--> apply Type2 logic---> insert/updateDB
We know from requirements that we will get dups from source with same value but the fact Qty might change.
Am I on the right direction? Please suggest
Mike we record every transaction. So if we have 3 transactions which occurred for a product we are pulling all three. One of the subset requirements is if these three transactions have same key then it will be either an update or an insert. We need to push three records into fact and 1 record as an update into dimension. As it is a Type 2, we need to insert one record in a dimension and update the previous one.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Your original post specified 8x, which is probably why Mike responded as he did.
In earlier versions you have to do all the coding yourself; the lookup on the business key, the testing to see whether the row exists and, if so, whether there are any changes, the generation of the new key value and the handling of the SCD2 dimension (SCD1 is a simple update).
In earlier versions you have to do all the coding yourself; the lookup on the business key, the testing to see whether the row exists and, if so, whether there are any changes, the generation of the new key value and the handling of the SCD2 dimension (SCD1 is a simple update).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Since it was just your curiosity, I didn't feel the urge to describe it for a DataStage version that is out of support.pavi wrote:Out of my curiosity ...
Ray's description of the old design pattern makes it obvious just how convenient the new SCD stage is.
One thing to add... since you have multiple change transactions coming on the stream input, the testing for type 2 changes becomes a little more complex... you need to check both the lookup results and the previous input record to determine changes.
Of course, if you'd really like to satisfy your curiosity, you can still create the 7X design pattern in an 8X environment.
Mike