One Star

Implementing INSERT INTO (...) SELECT ... FROM

Hi, first I am a beginner with this fantastic tool.
I've created a job that takes a few tasks as below:
STEP 1. IMPORT an Excel data INTO a MySQL table
STEP 2. SELECT a few fields from the MySQL table
STEP 3. INSERT the result of the SELECT into another MySQL table
Basically, this runs fine and I get what I want. However, I am not sure if this is a good way to do.
That is, instead of having the Step2 and Step 3 separately, which cause unnecessary traffic between the MySQL server and the TOS client, is there a way for me to do run one query something like "INSERT INTO ... SELECT"? If then, what component should I use?
Thanks,
Daniel
3 REPLIES
One Star

Re: Implementing INSERT INTO (...) SELECT ... FROM

If I were you I'd use tMap with a second output to the second table with just the columns you want in it. Do you actually need the first table? If not you can delete any of the undesired columns from the output side of any component...
tInputExcel --------->tMap -------------> Table1 and Table2
Also, if you are working with large tables you'll find that the mysqlbulkoutputexec is much faster...
Bluesin
Six Stars

Re: Implementing INSERT INTO (...) SELECT ... FROM

The ELT components provide this functionality. Look at the tELTMySqlMap. It is a bit different using the ELT components, I believe the Studio help provides an example.

Thanks!
Josh
Five Stars ami
Five Stars

Re: Implementing INSERT INTO (...) SELECT ... FROM

The ELT components provide this functionality. Look at the tELTMySqlMap. It is a bit different using the ELT components, I believe the Studio help provides an example.

      Thanks!
              Josh

Dear Members,
I  want to implement 
Insert into table 
(col1,
col2
...
con n)
Sel
col1,
col2,
...
con n
 from  table_name;
i want to implement above in talend 
how will i achive it>
can someone give me steps to do so 
help will be appretiated.
thanks,
Amit