Skip to content
Advertisement

How to automate a sql script in snowflake

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:

  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);
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement