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
Advertisement
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);