Task
Configuration can be provided to Snowflake Object Lifecycle Engine for the following operation with Task:
- Manage Lifecycle of new and existing Task
#
Supported ParametersThe 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.
- Configuration key:
- ENABLED: Specifies if the task should be started (enabled) after creation or should remain suspended (default).
- Configuration key:
enabled
- Configuration key:
- SCHEDULE: Specifies the schedule for periodically running the task. This can be a cron or interval in minutes.
- Configuration key:
schedule
- Data Type: Boolean
- Configuration key:
- 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
- Configuration key:
- 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
- Configuration key:
- WHEN: Specifies a Boolean SQL expression; multiple conditions joined with AND/OR are supported.
- Configuration key:
when
- Data Type: String
- Configuration key:
- COMMENT: Specifies a comment for the task.
- Configuration key:
comment
- Data Type: String
- Configuration key:
- GRANTS: List of Privileges and Roles to which privileges are granted to on the current Task.
- Configuration key:
grants
- Data Type: Map
- Configuration key:
- MANAGE_MODE: Configures what properties to manage for the Task.
- Configuration key:
manage_mode
- Data Type: String
- Possible Values:
none
grants
all
(Default)
- Configuration key:
#
AfterIn 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
#
Exampleafter: database: "DUMMY_DATABASE" schema: "PUBLIC" name: "mytask_minute"
#
Basic syntaxdatabases: <database-name>: schemas: <schema-name>: tasks: <task-name>: <configuration-key>: <value>
#
Supported Task Grants to RolesFollowing is the list of Privileges Grant to Roles that can be specified in the task definition
- ALL PRIVILEGES
- MONITOR
- OPERATE
- OWNERSHIP
#
Examplesdatabases: 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