1
votes

I have a SQL script that transforms data for various tables in snowflake. I need to run this SQL code daily and I want to automate it somehow. I thought I could automate the SQL with 'tasks' in snowflake but 'tasks' are unable to run more than one single SQL statement and my code contains a multitude of SQL statements. Does anyone have any ideas? Any help is appreciated

1
Put the SQL in a Stored Procedure and then use a Task to run the SPNickW
You can also have a task being dependent on the completion of another task. Might be an option if you're not dealing with too many statements.Phil Coulson

1 Answers

2
votes

If you want to automate more than one sql statement, you have two options:

  1. Run a task for each of your statements and build up dependencies between them
  2. Wrap your whole script into a stored procedure and trigger this procedure with your task. The statement for triggering the procedure is something like CALL myProcedure(optional parameters);