Operation of the Key Generation

Hello,

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!


adriano.tito (BOB member since 2017-04-26)

Welcome to B:bob:B!

Please let us know which tool from the SAP Business Objects suite of tools you use so this topic can be moved to a right forum.

Thanks.


Marek Chladny :slovakia: (BOB member since 2003-11-27)

Sap BODS (Businnes Object Data Services)


adriano.tito (BOB member since 2017-04-26)

[Moderator Note: So moving from General Discussion to Data Integrator -> DI: Designer and Job Design]


Marek Chladny :slovakia: (BOB member since 2003-11-27)

[quote:164916b69e=“adriano.tito”]Hello,

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.


ErikR :new_zealand: (BOB member since 2007-01-10)

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!


H. Westerhof :netherlands: (BOB member since 2010-03-26)

[quote:68db61c075=“adriano.tito”]Hello,

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.


eganjp :us: (BOB member since 2007-09-12)