Ask Your Question

Truncate tables from JDBC multiple consumer

asked 2020-07-14 09:34:51 -0500

phoenix gravatar image

I have a JDBC consumer that is pulling data from all the tables in a set schema. These are then loading into snowflake. I need to truncate all the snowflake versions of the tables before loading the data.

I did put the trucate statement a startevent jdbc query, however this requires creating a statement for each table, of which there are lot. If there any other to do this, wracked my brains for days.

I need to be able to get the list of table from jdbc.table attribute and run a truncate against each one, should be simple, but I can not see away to achieve this.

Any help appricated.



edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2020-07-15 19:00:52 -0500

iamontheinet gravatar image


You might be better off if you create a stored procedure on Snowflake and call that from Start Event >> JDBC Query so at least you don't have to write that many truncate statements in your pipeline. Otherwise, I imagine you'll have to use one of the scripting processors to get the table name from header attribute and then use some external lib (if there's one) to connect to Snowflake to execute the truncate query.

Cheers, Dash

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2020-07-14 09:34:51 -0500

Seen: 54 times

Last updated: Jul 15