Skip to main content

Task

Configuration can be provided to Snowflake Object Lifecycle Engine for the following operation with Task:

  • Manage Lifecycle of new and existing Task

Supported Parameters#

The runner supports below parameters.

  • SQL_STATEMENT: Any single SQL statement, or a call to a stored procedure, executed when the task runs.
    • Required
    • Configuration key: sql_statement
    • Data Type: String
  • WAREHOUSE: Specifies the virtual warehouse that is used to execute the task.
    • Required
    • Configuration key: warehouse
    • Data Type: String
  • AFTER: Specifies the predecessor task for the current task. When a run of the predecessor task finishes successfully, it triggers this task (after a brief lag).
    • Configuration key: after
    • Data Type: String/Object .See here for definition of AFTER.
  • ENABLED: Specifies if the task should be started (enabled) after creation or should remain suspended (default).
    • Configuration key: enabled
  • SCHEDULE: Specifies the schedule for periodically running the task. This can be a cron or interval in minutes.
    • Configuration key: schedule
    • Data Type: Boolean
  • SESSION_PARAMETERS: Specifies session parameters to set for the session when the task runs. A task supports all session parameters.
    • Configuration key: session_parameters
    • Data Type: Map of String
  • USER_TASK_TIMEOUT_MS: Specifies the time limit on a single run of the task before it times out (in milliseconds).
    • Configuration key: user_task_timeout_ms
    • Data Type: Number
  • WHEN: Specifies a Boolean SQL expression; multiple conditions joined with AND/OR are supported.
    • Configuration key: when
    • Data Type: String
  • COMMENT: Specifies a comment for the task.
    • Configuration key: comment
    • Data Type: String
  • GRANTS: List of Privileges and Roles to which privileges are granted to on the current Task.
    • Configuration key: grants
    • Data Type: Map
  • MANAGE_MODE: Configures what properties to manage for the Task.
    • Configuration key: manage_mode
    • Data Type: String
    • Possible Values:
      • none
      • grants
      • all(Default)

After#

In the After parameter of the Task, users can specify either just the name of After TASK(if After Task belongs to the same schema and database as the external table), or the name of schema and database as well.

See Database-Level Object Reference section for more information

The After parameter supports the following parameters if explicitly provided:

  • NAME: Name of the Task
    • REQUIRED
    • Configuration key: name
    • Data Type: String
  • SCHEMA: Name of the schema, in which the task exists
    • REQUIRED if Task is present in another Database or another Schema than the current one
    • Configuration key: schema
    • Data Type: String
  • DATABASE: Name of the database, in which the task exists
    • REQUIRED if Task is present in another Database than the current one
    • Configuration key: database
    • Data Type: String
Example#
after:  database: "DUMMY_DATABASE"  schema: "PUBLIC"  name: "mytask_minute" 

Basic syntax#

databases:  <database-name>:    schemas:      <schema-name>:        tasks:          <task-name>:            <configuration-key>: <value>

Supported Task Grants to Roles#

Following is the list of Privileges Grant to Roles that can be specified in the task definition

  • ALL PRIVILEGES
  • MONITOR
  • OPERATE
  • OWNERSHIP

Examples#

databases:  PRODUCTS_RECORD:    schemas:      PRODUCTS:        tasks:          TASK_1:            sql_statement: "<sql_statement>"            warehouse: "<warehouse_name>"            comment: "<task_comment>"            after:              database: "DUMMY_DATABASE"              schema: "PUBLIC"              name: "mytask_minute"            enabled: "true|false"            schedule: "10"            session_parameters:              timestamp_output_format: "DD-MM-YYYY HH24:MI:SS.FF3 TZHTZM"            user_task_timeout_ms: 10000            when: "foo AND bar"            grants:              MONITOR:                - ANALYST
Last updated on