Dynamic table loading

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
jusami25
Premium Member
Premium Member
Posts: 84
Joined: Tue Oct 26, 2004 12:49 am

Dynamic table loading

Post by jusami25 »

Hi all,

I would like to create a single DS job for loading a table by passing the table name. If I would have a job parameter for the table name, I would like to use that table name to retrieve the table structure (if I can access the data dictionary for retrieving the columns and data type) Then I would like to load the information.

If that possible in the server edition? and how about the parallel edition??

If anyone have any idea about how to speed up the loading of tables (even if they are quite similar) instead of creating tons of jobs, please let me know. This will help a lot.


Thanks so much in advance
Julio
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Jusami25,

Unfortunately this is not possible in Server, and in Px it is possible to use implicit columns but perhaps not to the extent that you wish.

Since an ETL process usually processes columns in addition to reading/writing them this type of job design is not too common. Are you reading and writing the data without any modifications at all?
krystlecsy
Participant
Posts: 50
Joined: Wed Jul 14, 2004 7:56 am

Post by krystlecsy »

Yeah, I am encountering a similar situation. I was hoping to pass in the column names through some routine? Is that possible then? Has anyone written such routines before? In other words, we just want to achieve some dynamic table loading. :(
WoMaWil
Participant
Posts: 482
Joined: Thu Mar 13, 2003 7:17 am
Location: Amsterdam

Post by WoMaWil »

I've never tested it, but in theory it should work, and here have been some folks who told they succeed. If you work with user defined SQL and you retrieve all fields like this:

PARAM1=TABLE_A
PARAM2=FIELD1||','||Field2||','||Field3
PARAM3=TABLE_B
PARAM4=FIELDA,FIELDB,FIELDC


the reading User-SQL would be so:

SELECT #PARAM2# FROM #PARAM1#;

the writing User-SQL would be so:

INSERT INTO #PARAM3# Fields (#PARAM4#) VALUES (:1)

That's it for numberfields.

For text-fields don't forget to quote them with single quotation-mark '
For Date and Time-fields use the to_char and to_date function in Oracle or simular in other databases.

If somebody succeeds to proceed in this way, please let me know.

The PARAM2 and the PARAM4 can be contructed easily by using the Metadata.

Kind regards
Wolfgang
Last edited by WoMaWil on Mon Jun 13, 2005 8:25 am, edited 2 times in total.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Wolfgang - great approach for Server! That's like Christmas, I will give that a try later on. {rubbing hands together in anticipation}
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

The idea is very good.

You may also need to ensure dates are converted correctly in source and target.
elavenil
Premium Member
Premium Member
Posts: 467
Joined: Thu Jan 31, 2002 10:20 pm
Location: Singapore

Post by elavenil »

Hi Wolfgang,

It is great idea. I tried and it is working fine.

Created four parameters as mentioned and i have used 2 columns (one integer and one varchar ). Did not find any problem while selecting the data from the source table as you mentioned but while loading the data into Oracle, it is not accepting only one value in the VALUES section. So i just split the columns into two in the transformer and assigned the columns in the value section. Then it works.

Once again thanks to have great idea like this.

Regards
Saravanan
jusami25
Premium Member
Premium Member
Posts: 84
Joined: Tue Oct 26, 2004 12:49 am

Dynamic table loading

Post by jusami25 »

Very good idea indeed,

but I'm thinking about the next stage after the OCI or DB stage. How if the columns names or datatypes are changing, then we have to use a table definition. How will we create dynamic table definitions also ??


Thanks the idea was veri good
Julio
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You create dynamic table definitions the same way you would in the database; that is, it's not possible without a lot of hacking.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply