Solved

Truncate table before insert

  • 9 November 2021
  • 2 replies
  • 56 views

I am trying to do an insert to CARTO table. It is mandatory to not drop the table because it is necessary anytime a table is created to make a specific SQL statement.

This table just has to have the last insert values so a truncate command is required.

I have tried with a SQL Executor with two statements. Truncate and Insert. What SQL Executor does is a truncate for every insert. At the end I have a table with only one row, the last value inserted.

Any ideas?

icon

Best answer by nielsgerrits 9 November 2021, 15:20

View original

2 replies

Userlevel 6
Badge +32

You can use 2 SQLExecutors, one for one truncate and the other for the inserts. Using a Sampler and a FeatureHolder you should be able to run the truncate statement once and the insert statements after the truncate statement.

 

2021-11-09_15h24_43 

As an alternative you could use an Aggregator to merge all insertrows in one feature, then add a truncaterow above it.

Got it! Thank you!

Reply