Question

How to truncate a table while the writer is empty.

  • 31 March 2021
  • 6 replies
  • 55 views

Badge +3

Hi,

 

I have a workspace that truncates an SDE geometry table and refills it. The workspace runs daily and sometimes there are no records to write. In that case the writer only has to truncate the table. I don't see an option truncate first or anything like that in a sde writer.

How can I truncate a table while the writer is empty?

 

 


6 replies

Userlevel 1
Badge +21

For this sort of scenario, I'd truncate the tables using an sqlexecutor upstream of the writers to ensure all tables are truncated.

Badge +3

Thanks. Now I use a creator followed by a sqlexecuter. This works.

Badge

In my case I'd like to truncate the table (FGDB feature class) that is in the Reader, after the table has been read. Is that possible?

Badge +3

I do not know. i never truncated right after the reader. I have to test it.

Userlevel 4
Badge +36

An SQLExecutor downstream of the Reader should do the trick.

Note that one SQL query is issued for each feature that enters the transformer. So do make sure only one feature enters the SQLExecutor!

Maybe use a Sampler (sample the last feature!), or the combination of a Creator and a FeatureReader.

Trigger_SQLExecutor

Badge +3

Thanks, i will try this.

Reply