# Task

[Snowflake Documentation](https://docs.snowflake.com/en/sql-reference/sql/create-task)

Represents a scheduled task in Snowflake that performs a specified SQL statement at a recurring interval.

## Examples

### Python

```python
task = Task(
    name="some_task",
    warehouse="some_warehouse",
    schedule="USING CRON 0 9 * * * UTC",
    state="SUSPENDED",
    as_="SELECT 1"
)
```

### YAML

```yaml
tasks:
  - name: some_task
    warehouse: some_warehouse
    schedule: "USING CRON 0 9 * * * UTC"
    state: SUSPENDED
    as_: |
        SELECT 1
```

## Fields

* `warehouse` (string or [Warehouse](/titan-core/resources/warehouse.md)) - The warehouse used by the task.
* `user_task_managed_initial_warehouse_size` (string or [WarehouseSize](https://github.com/Titan-Systems/titan/blob/main/docs/resources/warehouse_size.md)) - The initial warehouse size when the task is managed by the user. Defaults to None.
* `schedule` (string) - The schedule on which the task runs.
* `config` (string) - Configuration settings for the task.
* `allow_overlapping_execution` (bool) - Whether the task can have overlapping executions.
* `user_task_timeout_ms` (int) - The timeout in milliseconds after which the task is aborted.
* `suspend_task_after_num_failures` (int) - The number of consecutive failures after which the task is suspended.
* `error_integration` (string) - The integration used for error handling.
* `copy_grants` (bool) - Whether to copy grants from the referenced objects.
* `comment` (string) - A comment for the task.
* `after` (list) - A list of tasks that must be completed before this task runs.
* `when` (string) - A conditional expression that determines when the task runs.
* `as_` (string) - The SQL statement that the task executes.
* `state` (string or [TaskState](https://github.com/Titan-Systems/titan/blob/main/docs/resources/task_state.md), required) - The initial state of the task. Defaults to SUSPENDED.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://titan-core.gitbook.io/titan-core/resources/task.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
