SYSTEM$PREDECESSORS_STATE

functionsupportedUDFs, procedures, tasks, alerts, scriptingpreview

docs.snowflake.com ↗

System functions

Indicates whether the predecessors of the current task completed in the states described by a specified condition. Use this function in the WHEN clause of a task in a task graph to run the task on outcomes other than “all predecessors succeeded.” For an explanation of how this function changes the way Snowflake schedules tasks in a graph, see How advanced branching changes scheduling.

Syntax

SYSTEM$PREDECESSORS_STATE('<condition>')

Parameters

NameRequiredDescription
'condition'requiredThe condition to evaluate against the completion states of the current task’s predecessors. Specify one of the following values: Condition Returns TRUE when ALL_SUCCEEDED Every predecessor succeeded. This is the default condition that Snowflake applies to a task that doesn’t specify a predecessor condition. ALL_FAILED Every predecessor failed. ALL_DONE Every predecessor reached a terminal state, in any combination of SUCCEEDED, FAILED, SKIPPED, and CANCELLED. ALL_SKIPPED Every predecessor was skipped. AT_LEAST_ONE_FAILED One or more predecessors failed. AT_LEAST_ONE_SUCCEEDED One or more predecessors succeeded. NONE_FAILED No predecessor failed. Every predecessor either succeeded or was skipped. NONE_FAILED_MIN_ONE_SUCCEEDED No predecessor failed, and at least one predecessor succeeded. NONE_SKIPPED No predecessor was skipped. Every predecessor either succeeded or failed.ExpandShow lessSee more The condition name must be enclosed in single quotes.

Returns

Returns TRUE if the completion states of the current task’s predecessors satisfy the specified condition, and FALSE otherwise.

Usage notes