1

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

2
  • 3
    Put the SQL in a Stored Procedure and then use a Task to run the SP Commented Feb 22, 2021 at 20:12
  • 1
    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. Commented Feb 22, 2021 at 22:24

1 Answer 1

2

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);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.