Can we parametrize snowflake tasks?

Viewed 83

I need to do one-time historical data load, followed by incremental load every 10 minutes.

is there a way to parametrize snowflake task to 1st run the historical load and then change the parameter to execute incremental loads? if not, can you suggest a better approach to handle historical (One-time) and incremental loads via tasks

Note: An underlying table of snowflake stream contains historical records and any new data after implementing stream/tasks is considered as incremental.

1 Answers

if you have a task call a stored procedure, you could have the stored procedure first check to see if the target table is empty (or whatever check you want. As long as you can write it as code, it'll work. Heck you could have it insert a task run log into a separate table, and check to see if it's the first time it's run.) and do the initial historical load in that case, and not otherwise.

Then the first time you run it, it will do one code path, and foreverafter it will do the other.

Related