Generic job DB to DB load with Upsert Write mode

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
DVP-NSIT
Premium Member
Premium Member
Posts: 5
Joined: Mon Feb 17, 2014 7:42 am

Generic job DB to DB load with Upsert Write mode

Post by DVP-NSIT »

Hello,

I have to load 350+ tables from one Database into another database.
I am trying to see if it is possible to use just one generic job to do this.

- My source Stage uses a parameter for the table name an the SQL is generated automatically at runtime.
- My target uses a parameter for the table name an the SQL is generated automatically at runtime.
- RCP is on

If Write mode for the target Table is Insert, then everything works fine.

However, if I set it to Updtate then Insert, I get the following message:
The connector could not automatically generate the WHERE clause for the UPDATE statement. Specify at least one key column in the input schema
My issue is that I don't know how to tell DataStage what keys for the update are.
The question then is, how can I tell DataStage what my Update key column is ?

Let's assume there's only one column to define for the Update key...
I thought of using the Modify Stage to pass the key column as a parameter called #pKEY1#

What I did is:
Source Table -> Transformer Stage (Create a new column named KEYTEMP and define it as a key) -> Modify Stage (KEYTEMP=#pKEY1#) -> Modify Stage 2 (#pKEY1#=KEYTEMP) -> Target Table (Upsert mode)
I thought that at the "#pKEY1#=KEYTEMP" step, the column #pKEY1# would have gotten the "key property definition" of KEYTEMP...
But no, the job fails lamentably for the same reason :( :
"The connector could not automatically generate the WHERE clause for the UPDATE statement. Specify at least one key column in the input schema"

I would be curious to know if there is a way around this problem... Even if I have the feeling that I will have to write 350+ jobs :?

Thanks for your help ! :)
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Use a Modify stage, which can accept a job parameter as a column name in a derivation expression.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Perhaps this will help:

viewtopic.php?t=147155
-craig

"You can never have too many knives" -- Logan Nine Fingers
DVP-NSIT
Premium Member
Premium Member
Posts: 5
Joined: Mon Feb 17, 2014 7:42 am

Post by DVP-NSIT »

Thank you Chullet.

I have tried the Generic stage as described by ArndW in his post.
It works well.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Excellent!
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply