Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Delete multiple tables

Hello Talend Community,

I'm an absolute beginner in Talend. I have to create a job to have to:

 

Task1. Delete some rows from  tableNameA which correspond to certain conditions, more precisely Status1=xy and Status2 = tz. This is actually quiet simple since these conditions are included into the WHERE clause in the query:

 

DELETE FROM TableNameA

WHERE Status1 = xy AND Status2 = tz

 

The query above will delete all the rows that matches the WHERE clause, including values of a column named DeliveryId.

 

Task2. Drop multiple tables, said tableNameB,  that contain the same DeliveryId column as tableNameA. Note that tables B are named according to the following format: "tableNameB_xyz", where xyz is the DeliveryId.

 

In my job I use a tFlowToIterate component linked to a tMySqlRow component in order to perform task 1, as can be seen in the attached figure. 

My question is, how can I drop all the tables "tableNameB_xyz" that match the DeliveryId selected in Task1?

 

Thanks in advance

Best Regards,

 

A.

Labels (2)
1 Reply
vapukov
Master II
Master II

Hi,

 

it is not about Talend, it about database

you need add 1 more iterate level for each parent iteration

use tMySQLInput for request all tables with matched name from information_schema

https://dev.mysql.com/doc/refman/8.0/en/tables-table.html

 

select TABLE_NAME from information_schema.TABLES where TABLE_NAME LIKE 'tabel_pattern'+XXX

iterate thru resultset and use data for prepare delete statements