How can I set conditional child task to continue or pause based on status (success/failure/warning) of a parent task in SnowFlake data warehouse?

huangapple go评论55阅读模式
英文:

How can I set conditional child task to continue or pause based on status (success/failure/warning) of a parent task in SnowFlake data warehouse?

问题

Currently evaluating Snowflake database for our data warehouse, based on their documentation, Looks like Snowflake do have support for scheduling Tasks and create task tree hierarchy.

Snowflake does seem to support conditional child task but I can't figure out setting up a conditional task to continue or pause child task based on parent task success/warning or failure.

Sample Task tree creation in Snowflake

// Create a child task
CREATE OR REPLACE TASK DATA_IMPORT
WAREHOUSE = COMPUTE_WH
SCHEDULE = '60 MINUTE'

AS
INSERT INTO CUSTOMERS2 SELECT * FROM CUSTOMERS;

// Create a child task
CREATE OR REPLACE TASK DATA_IMPORT
WAREHOUSE = COMPUTE_WH
WHEN 1=2 // SAMPLE CONDITION
AFTER DATA_IMPORT
AS
CALL POST_PROCESS_STORED_PROCEDURE( );

Would appreciate any pointers if you have more knowledge on Snowflake Task structure.
Thank you

英文:

Currently evaluating Snowflake database for our data warehouse, based on their documentation, Looks like Snowflake do have support for scheduling Tasks and create task tree hierarchy.

Snowflake does seem to support conditional child task but I can't figure out setting up a conditional task to continue or pause child task based on parent task success/warning or failure.

## Sample Task tree creation in Snowflake

// Create a child task
CREATE OR REPLACE TASK DATA_IMPORT
WAREHOUSE = COMPUTE_WH
SCHEDULE = ‘60 MINUTE’

AS
INSERT INTO CUSTOMERS2 SELECT * FROM CUSTOMERS;

// Create a child task
CREATE OR REPLACE TASK DATA_IMPORT
WAREHOUSE = COMPUTE_WH
WHEN 1=2  // SAMPLE CONDITION
AFTER DATA_IMPORT
AS
CALL POST_PROCESS_STORED_PROCEDURE( );

Would appreciate any pointers if you have more knowledge on Snowflake Task structure.
Thank you

答案1

得分: 1

CREATE TASK:

AFTER string [ , string , ... ]

指定一个或多个当前任务的前置任务。使用此选项创建任务的有向无环图(DAG),或将此任务添加到现有的DAG 中。DAG 是一系列任务,以一个计划的根任务开始,并由依赖关系相连。

一个任务只有在其所有前置任务成功完成它们自己的运行之后才会运行(经过一段短暂的延迟)。


CREATE TASK - Examples

...

只有在所有指定的前置任务成功完成它们自己的运行之后,子任务才会运行。

英文:

CREATE TASK:

> AFTER string [ , string , ... ]
>
> Specifies one or more predecessor tasks for the current task. Use this option to create a DAG of tasks or add this task to an existing DAG. A DAG is a series of tasks that starts with a scheduled root task and is linked together by dependencies.
>
> A task runs after all of its predecessor tasks have finished their own runs successfully (after a brief lag).
>
> ---
>
> CREATE TASK - Examples
>
>
> ...
>
> The child task runs only after all specified predecessor tasks have successfully completed their own runs.

huangapple
  • 本文由 发表于 2023年4月17日 01:46:47
  • 转载请务必保留本文链接:https://go.coder-hub.com/76029402.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定