英文:
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
AFTER string [ , string , ... ]
指定一个或多个当前任务的前置任务。使用此选项创建任务的有向无环图(DAG),或将此任务添加到现有的DAG 中。DAG 是一系列任务,以一个计划的根任务开始,并由依赖关系相连。
一个任务只有在其所有前置任务成功完成它们自己的运行之后才会运行(经过一段短暂的延迟)。
...
只有在所有指定的前置任务成功完成它们自己的运行之后,子任务才会运行。
英文:
> 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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论