Task with multiple stored procedures

Viewed 622

Is there a way to create a task within snowflake to call multiple stored procedures?

For example I have three stored procedures to check for duplicated information over multiple tables, I'd like to call all three through the task without having to create a new SP to loop through them all.

2 Answers

A task can only trigger one SQL statement or one Stored Procedure.

So you have to decide:

  1. One task for each procedure with dependencies between the tasks
  2. One task with a wrapper procedure that calls all the three Stored Procedures (the solution you do not want to have)

I think chaining the tasks is a good solution. You have to use the AFTER-clause within your CREATE TASK-statement to achieve the correct dependencies: https://docs.snowflake.com/en/sql-reference/sql/create-task.html

A task can only call 1 SP so if you don't want to write one SP that calls the others then how about creating a chain of 3 tasks?

Related