Week 76 - Tasks & Scheduling
One of the things that we're trying to create as Engineers is a robust system that keeps working through failure.
This week we're going to expand these capabilities when looking at tasks : Even though a task fails , it's chained task must still continue.
For this challenge , we've got a task that is very error prone (for some reason that we still haven't figured out ;) ) but even if it DOES fail, we still want a notification in our table that the task itself failed.
The code:
CREATE OR REPLACE TABLE task_table (stamp time, message varchar);CREATE OR REPLACE TASK main_taskSCHEDULE = '1 minute'USER_TASK_MANAGED_INITIAL_WAREHOUSE_SIZE = 'XSMALL'ASSELECT CASEWHEN RANDOM() <0 THEN 1/0ELSE 1END;CREATE OR REPLACE TASK child_taskAFTER main_taskASINSERT INTO task_table (stamp,message) VALUES(CURRENT_TIMESTAMP,'main_task succes!');The challenge
We want you to write a task that is chained to main_task and always runs even if the main_task fails.
The task should simply insert the message 'task ran' into task_table with an accompanying timestamp