- execute long-running tasks in the background (supported from v2.5 onwards)
- schedule a task at a regular interval (supported from v3.3 onwards)
- CREATE TABLE AS SELECT (from v3.0 onwards)
- INSERT (from v3.0 onwards)
- CACHE SELECT (from v3.3 onwards)
INFORMATION_SCHEMA.tasks, or view the execution history of tasks by querying INFORMATION_SCHEMA.task_runs. For more information, see Usage Notes.
You can modify an asynchronous task using ALTER TASK, or drop an asynchronous task using DROP TASK.
Syntax
PROPERTIES
You can add thesession. prefix before session variables to change the task running context configurations.
Tip
You can set the
warehouse property in the statement to specify the warehouse used for this operation. By default, default_warehouse is used.
For example, the following statement submits a task named test_task with session properties which enables query profile and increase query timeout:
Parameters
Return value
TaskName: The name of the task.Status: The status of the task. Valid values:SUBMITTED: The task has been submitted.REJECTED: The task has been rejected.FAILED: The task has failed.
Usage notes
This statement creates a Task, which is a template for storing a task that executes the ETL statement. You can check the information of the Task by querying the metadata viewtasks in Information Schema.
PENDING: The task waits to be run.RUNNING: The task is running.FAILED: The task failed.SUCCESS: The task runs successfully.
task_runs in Information Schema.
Configure via FE configuration items
You can configure asynchronous ETL tasks using the following FE configuration items:Examples
Example 1: Submit an asynchronous task forCREATE TABLE tbl1 AS SELECT * FROM src_tbl, and specify the task name as etl0:
INSERT INTO tbl2 SELECT * FROM src_tbl, and specify the task name as etl1:
INSERT OVERWRITE tbl3 SELECT * FROM src_tbl:
INSERT OVERWRITE insert_wiki_edit SELECT * FROM source_wiki_edit without specifying the task name, and extend the query timeout to 100000 seconds using the hint: