Ask Your Question
0

How do I truncate a database table before writing data to it?

asked 2017-12-13 11:49:22 -0500

metadaddy gravatar image

I want to build a pipeline that will replicate all data from one JDBC source to another, but before moving data I have to truncate the destination table.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-12-13 11:51:00 -0500

metadaddy gravatar image

You can use the Pipeline Start event with the JDBC Query Executor to run TRUNCATE on your destination table.

Hint - use pipeline parameters so you only have to specify details such as the JDBC URL in one place:

image description

edit flag offensive delete link more

Comments

Hi, Metadaddy, I am trying to do the same thing, but I encountered the error: com.streamsets.pipeline.api.StageException: JDBC_14 - Error processing batch. SQLState: 42000 Error Code: 933 Message: ORA-00933: SQL command not properly ended. The query is almost the same but using literal tablename.

weicui gravatar imageweicui ( 2020-01-02 19:28:34 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2017-12-13 11:49:22 -0500

Seen: 943 times

Last updated: Dec 13 '17