Categories:

Information Schema , Table functions

TASK_DEPENDENTS¶

This table function returns the list of child tasks for a given root task in a task graph.

Syntax¶

TASK_DEPENDENTS(
      TASK_NAME => '<string>'
      [, RECURSIVE => <Boolean> ] )
Copy

Arguments¶

TASK_NAME => 'string'

A string specifying a task. The function returns the specified root task as the first entry, followed by the list of child tasks.

  • Note that the entire name must be enclosed in single quotes, including the database and schema (if the name is fully-qualified), i.e. '<db>.<schema>.<task_name>'.

  • If the task name is case-sensitive or includes any special characters or spaces, double quotes are required to process the case/characters. The double quotes must be enclosed within the single quotes, i.e. '"<task_name>"'.

RECURSIVE => Boolean

Specifies whether to limit the output to include only direct child tasks or to include all recursive child tasks.

Values:

TRUE: Returns all recursive child tasks (children, grandchildren, etc.) in the output.

FALSE: Returns only direct child tasks in the output.

Default: TRUE.

Usage notes¶

  • Only returns rows for a task owner (i.e. the role with the OWNERSHIP privilege on a task) or a role with either the MONITOR or OPERATE privilege on a task.

  • When calling an Information Schema table function, the session must have an INFORMATION_SCHEMA schema in use or the function name must be fully-qualified. For more details, see Snowflake Information Schema.

Output¶

The function output provides table properties and metadata in the following columns:

| created_on | name | database_name | schema_name | owner | comment | warehouse | schedule | predecessors | state | definition | condition |
Copy

Column

Description

created_on

Date and time when the task was created.

name

Name of the task.

database_name

Database for the schema for the task.

schema_name

Schema for the task.

owner

Role that owns the task (i.e. has the OWNERSHIP privilege on the task)

comment

Comment for the task.

warehouse

Warehouse that provides the required resources to run the task.

schedule

Schedule for running the task. Displays NULL if no schedule is specified.

predecessors

JSON array of any tasks identified in the AFTER parameter for the task (i.e. predecessor tasks). When run successfully to completion, these tasks trigger the current task. Individual task names in the array are fully-qualified (i.e. include the container database and schema names). . . Displays an empty array if the task has no predecessor.

state

‘Started’ or ‘Suspended’ based on the current state of the task.

definition

SQL statements executed when the task runs.

condition

Condition specified in the WHEN clause for the task.

Examples¶

Retrieve the list of direct child tasks for the mydb.myschema.mytask task:

select *
  from table(information_schema.task_dependents(task_name => 'mydb.myschema.mytask', recursive => false));
Copy