I would like to know the behavior of the Key Generation component. In case I’m giving the compomente some records (update and insert). The update replays are not being considered by the component (correctly). For the insert records we have null and non-null keys. I understand that the component must get the key just to insert records with null key, but it is generating key for all records to insert. This is correct?
I would like to know the behavior of the Key Generation component. In case I’m giving the compomente some records (update and insert). The update replays are not being considered by the component (correctly). For the insert records we have null and non-null keys. I understand that the component must get the key just to insert records with null key, but it is generating key for all records to insert. This is correct?
Thank you!
[/quote]
It would be handy if you can post a screenshot of your DF.
But assuming a typical SCD2 setup (TC -> HP -> KG -> Target), records flagged with anything else but “I” operations bypass the KG transform. For any inserts, the KG will look at the max/last value of the surrogate key column and increase by the increment value specified in the transformation options.
A thing I sometimes forget, is that I build the dataflow using a template table, and using gen_row_num() for the technical key when I run it for the first time.
But then, when you import the table, add the table comparison and the key gen objects, you HAVE to remove the gen_row_num() function. Because when a row changes, the technical key value created by the gen_row_num() will be used instead of maintaining the key it already has!
I would like to know the behavior of the Key Generation component. In case I’m giving the compomente some records (update and insert). The update replays are not being considered by the component (correctly). For the insert records we have null and non-null keys. I understand that the component must get the key just to insert records with null key, but it is generating key for all records to insert. This is correct?
[/quote]
My recollection is that it assigns a new key value for each row that is considered an Insert. In my Dataflows I do NOT create the surrogate key column in the Query transforms prior to the Table Comparison. The Table Comparison will populate the surrogate key column for you when the row is an update. Inserts will remain NULL (as they should be) and the Key Generation transform will provide a new key value.