SQL DDL File execution

One Star

SQL DDL File execution

Hi,
I am new to Talend and maybe I have missed something (I Hope) that will allow me to execute SQL statements stored in a file. Specifically I have a DDL script that I want to run to create all of the data structures -- Types, Tables, Indexes, Constraints, FK, etc prior to doing the data load steps. Is there a simple way to do this? I am currently trying to do this against a DB2 database but will want this to be database agnostic. I would prefer to do this all within Talend as part of a job rather than use a separate tool to do the ddl and then talend for the dataload.
The data in the flat file generated by ER/Studio I want to load looks something like this (times hundreds of tables):

CREATE DISTINCT TYPE ADDRESSGENERAL AS VARCHAR(40) WITH COMPARISONS
;
CREATE DISTINCT TYPE BITMAP AS CHAR(128) WITH COMPARISONS
;
We are using TOS2.2.1

Thanks in advance for any direction you can give me on this.
Employee

Re: SQL DDL File execution

Hi,
If you have a fileInput with one Query per line like that :
UPDATE SAMPLE SET GROUP_ID = 'TEST1'
UPDATE SAMPLE SET GROUP_ID = 'TEST2'
UPDATE SAMPLE SET GROUP_ID = 'TEST3'
You can specify this file input into MetadataSchema fileDelimited :
1 column named Query for example.
Then, you are designing a Job like the following screenshot.
In the tDB2Row component, the Query specified is a Dynamic query provides by the FileInputDelimited.
For each row, you will have a run of your selected query.
In the query field, specify this dynamic query like that : ""+row1.Query+"" => row1 is the name of your Link between your components, Query is the name of your Column in the Schema.
IMPORTANT : your query must have no ";" character in end of line, keep just the SQL query.
Regards.