Schema:

ACCOUNT_USAGE

TASKS view

This Account Usage view displays a row for each task defined in your account.

Columns

Column NameData TypeDescription
CREATEDTIMESTAMP_LTZDate and time when the task was created.
LAST_ALTEREDTIMESTAMP_LTZDate and time when the task was last altered.
DELETEDTIMESTAMP_LTZDate and time when the task was dropped. NULL if the task hasn’t been dropped.
IDVARCHARUnique identifier for each task. Note that recreating a task (using CREATE OR REPLACE TASK) essentially creates a new task with a new ID.
TASK_NAMEVARCHARName of the task.
TASK_DATABASE_IDNUMBERInternal identifier for the database in which the task is stored.
TASK_DATABASEVARCHARDatabase in which the task is stored.
TASK_SCHEMA_IDNUMBERInternal identifier for the schema in which the task is stored.
TASK_SCHEMAVARCHARSchema in which the task is stored.
TASK_OWNERVARCHARRole that owns the task; that is, has the OWNERSHIP privilege on the task.
COMMENTVARCHARComment for the task.
WAREHOUSEVARCHARWarehouse that provides the required resources to run the task.
SCHEDULEVARCHARSchedule for running the task. Displays NULL if no schedule is specified or the task is a triggered task.
PREDECESSORSARRAYJSON array of any tasks identified in the AFTER parameter for the task (that is, predecessor tasks). When run successfully to completion, these tasks trigger the current task. Individual task names in the array are fully qualified (that is, they include the container database and schema names).

Displays an empty array if the task has no predecessor.
STATEVARCHARCurrent state of the task: started or suspended.
DEFINITIONVARCHARSQL statements executed when the task runs.
CONDITIONVARCHARCondition specified in the WHEN clause for the task.
ALLOW_OVERLAPPING_EXECUTIONBOOLEANFor root tasks in a task graph, displays TRUE if overlapping execution of the task graph is explicitly allowed. For child tasks in a task graph, displays NULL.
ERROR_INTEGRATIONVARCHARName of the notification integration used to access Amazon Simple Notification Service (SNS), Google Pub/Sub, or Microsoft Azure Event Grid to relay error notifications for the task.
LAST_COMMITTEDTIMESTAMP_LTZTimestamp when a version of the task was last set. If no version was set—that is, if the task wasn’t resumed or manually run after it was created—the value is NULL.
LAST_SUSPENDEDTIMESTAMP_LTZTimestamp when the task was last suspended. Displays the timestamps for both the root tasks and the child tasks. NULL if the task hasn’t been suspended yet.
OWNER_ROLE_TYPEVARCHARThe type of role that owns the object. Common values include ROLE, DATABASE_ROLE, APPLICATION, APPLICATION PACKAGE SHARE, USER, SHARE, and others.
INSTANCE_IDNUMBERInternal/system-generated identifier for the instance which the object belongs to.
CONFIGVARCHARFor the root task in a task graph, displays the default configuration set in the task definition with CREATE TASK or ALTER TASK. For child tasks in a task graph, displays NULL. Returns an empty string for tasks in shared databases or application instances where the consumer account differs from the provider account.
TASK_RELATIONSOBJECTJSON object describing the task relationships. Can contain: Predecessors (array of fully qualified predecessor task names), FinalizerTask (fully qualified name of the finalizer task, for root tasks that have a finalizer task), and FinalizedRootTask (fully qualified name of the root task being finalized, for finalizer tasks only).
TASK_RELATIONS_IDSOBJECTSame as TASK_RELATIONS, but displays the identifier of each related task instead of its fully qualified name.
LAST_SUSPENDED_REASONVARCHARReason the task was suspended. Possible values: USER_SUSPENDED, SCHEMA_OR_DATABASE_DELETED, GRANT_OWNERSHIP, SUSPENDED_DUE_TO_ERRORS, CHILD_BECAME_ROOT, FINALIZER_BECAME_ROOT, APPLICATION_IS_DISABLED, SUSPENDED_DUE_TO_OVERRUNS, REPLICATED_WITHOUT_GRANT. NULL if the task has never been suspended.
SUCCESS_INTEGRATIONVARCHARName of the notification integration used to access Amazon Simple Notification Service (SNS), Google Pub/Sub, or Microsoft Azure Event Grid to relay success notifications for the task.
SCHEDULING_MODEVARCHARDisplays whether a serverless task is FIXED or FLEXIBLE. NULL for warehouse tasks. Note: Support for FLEXIBLE mode will end in a future release.
TARGET_COMPLETION_INTERVALVARCHARTarget completion interval for a serverless task. Used to determine compute resource size for execution.
EXECUTE_AS_USER_IDNUMBERInternal identifier for the task’s execute-as user. NULL if the task is configured to execute as the system user (default). Can be joined with ACCOUNT_USAGE.USERS on the USER_ID column.
OVERLAP_POLICYVARCHAROverlap policy for the task. Possible values: NO_OVERLAP (task graph runs can’t execute concurrently), ALLOW_CHILD_OVERLAP (runs may execute concurrently but only one root task run at a time), ALLOW_ALL_OVERLAP (runs may execute fully concurrently; root tasks only). NULL for child tasks and finalizer tasks.
CREATED_BY_USER_IDNUMBERThe identifier of the user to whom the system attributes creating the task.

Usage notes

  • Dropped tasks have NULL values in columns that reference the task’s predecessors, finalizer, and finalized root task (PREDECESSORS, TASK_RELATIONS, and TASK_RELATIONS_IDS). To get information about the relations of a dropped task, query the TASK_VERSIONS view view.
  • The LAST_ALTERED column is updated when the following operations are performed on an object:
    • DDL operations.
    • Background maintenance operations on metadata performed by Snowflake.

Examples

Retrieve all active tasks with names matching a specific pattern:

SELECT * FROM SNOWFLAKE.ACCOUNT_USAGE.TASKS
WHERE TASK_NAME ILIKE 'ABC%'
  AND DELETED IS NULL;

Retrieve task relations for dropped non-root tasks by joining with the TASK_VERSIONS view:

SELECT
    TASKS.ID,
    TASKS.TASK_NAME,
    TASK_VERSIONS.TASK_RELATIONS,
    TASK_VERSIONS.GRAPH_VERSION
FROM SNOWFLAKE.ACCOUNT_USAGE.TASKS
INNER JOIN SNOWFLAKE.ACCOUNT_USAGE.TASK_VERSIONS
    ON TASK_VERSIONS.ID = TASKS.ID
WHERE TASKS.DELETED IS NOT NULL
  AND TASK_VERSIONS.ROOT_TASK_ID != TASK_VERSIONS.ID;