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
-
3Put the SQL in a Stored Procedure and then use a Task to run the SPNickW– NickW2021-02-22 20:12:03 +00:00Commented Feb 22, 2021 at 20:12
-
1You 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.Rajat– Rajat2021-02-22 22:24:43 +00:00Commented Feb 22, 2021 at 22:24
Add a comment
|
1 Answer
If you want to automate more than one sql statement, you have two options:
- Run a task for each of your statements and build up dependencies between them
- 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);