How to clear / truncate a table without doing an insert?

Highlighted
One Star

How to clear / truncate a table without doing an insert?

I have a job where I want to clear the destination MySQL table at the start of the whole job. I can't use the "Clear table" action-on-table setting on the MySQL output component because the job iterates through a series of inserts, and if I use that then each insert also clears the results of the previous inserts in *this* execution (I am only trying to clear the results of *previous* executions). Please see the attached pic for a clearer explanation.
So basically, how can I easily clear the entire table before I even start?
Any help much appreciated.
One Star

Re: How to clear / truncate a table without doing an insert?

Actually don't worry, I figured it out ... you use the tMysqlRow component to just execute arbitrary SQL with a "truncate" statement in it.
Six Stars

Re: How to clear / truncate a table without doing an insert?

Hey, 

 

Actually I wanted to implement a similar case. How does the connection look like?

 

Thanks!

Employee

Re: How to clear / truncate a table without doing an insert?

@Harguna 

 

    The action on Table will happen only once per execution and not at individual row.

 

     Lets stick to your other post since we are already interacting there.

 

https://community.talend.com/t5/Design-and-Development/How-do-I-clear-a-table-in-TOS-before-transfer...

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved :-)

 

 

 

 

15TH OCTOBER, COUNTY HALL, LONDON

Join us at the Community Lounge.

Register Now

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Why Companies Move to the Cloud: 7 Success Stories

Learn how and why companies are moving to the Cloud

Read Now