alterTask
Alters an existing Snowflake task with comprehensive configuration options including comment, schedule, tags, contacts, session parameters, warehouse, execution settings, predecessors, conditional execution, state management, and more.
Note: This change type does not support automatic rollback or database inspection features (snapshot, diff, diff-changelog, and generate-changelog commands).
Available attributes
Name | Type | Description | Required |
|---|---|---|---|
| String | Name of the catalog (database) containing the task | No |
| String | Name of the schema containing the task | No |
| String | Name of the task to alter | Yes |
| Boolean | If true, uses | No |
| String | Notification integration to call when task encounters errors | No |
| String | Notification integration to call when task completes successfully | No |
| Nested | Modify or remove task comment | No |
| Nested | Modify or remove task schedule | No |
| Nested | Add or remove tags | No |
| Nested | Set or unset session parameters | No |
| Nested | Add or remove contacts | No |
| Nested | Modify the SQL statement executed by the task | No |
| Nested | Change warehouse settings | No |
| Nested | Control concurrent execution | No |
| Nested | Suspend or resume task execution | No |
| Nested | Modify task configuration | No |
| Nested | Modify conditional execution | No |
| Nested | Manage task predecessors (dependencies) | No |
| Nested | Change execution context | No |
| Nested | Set or remove finalizer task | No |
| Nested | Set target completion time (serverless tasks) | No |
Nested elements
Each nested element represents a specific alteration operation. Only include the elements for the properties you want to modify.
alterComment - Modify or remove task comment:
Attribute | Type | Description | Required |
|---|---|---|---|
| String | New comment text | No* |
| Boolean | If true, removes the comment | No* |
*Exactly one of newComment or unsetComment must be specified.
alterSchedule - Modify or remove task schedule:
Attribute | Type | Description | Required |
|---|---|---|---|
| String | New schedule (e.g., | No* |
| Boolean | If true, removes the schedule | No* |
*Exactly one of newSchedule or unsetSchedule must be specified.
alterTags - Add or remove tags:
Attribute | Type | Description | Required |
|---|---|---|---|
| MapWrapper | Key-value pairs of tags to set | No* |
| String | Space-separated tag names to unset (e.g., | No* |
*Exactly one of setTags or unsetTags must be specified. Tags must exist before being set.
alterSessionParams - Set or unset session parameters:
Attribute | Type | Description | Required |
|---|---|---|---|
| MapWrapper | Key-value pairs of session parameters (e.g., | No* |
| String | Space-separated parameter names to unset | No* |
*Exactly one of setSessionParams or unsetSessionParams must be specified.
alterContacts - Add or remove contacts:
Attribute | Type | Description | Required |
|---|---|---|---|
| MapWrapper | Key-value pairs mapping contact purposes to contact names | No* |
| String | Space-separated contact purposes to unset | No* |
*Exactly one of setContacts or unsetContacts must be specified. Valid purposes: steward, support, access_approval. Contacts must exist before being set.
alterAsClause - Modify the SQL statement executed by the task:
Attribute | Type | Description | Required |
|---|---|---|---|
| String | New SQL statement | Yes |
alterWarehouse - Change warehouse settings:
Attribute | Type | Description | Required |
|---|---|---|---|
| String | New warehouse name | No* |
| String | Initial warehouse size for serverless tasks | No* |
| Boolean | If true, removes warehouse assignment | No* |
*Exactly one option must be specified.
alterAllowOverlappingExecution - Control concurrent execution:
Attribute | Type | Description | Required |
|---|---|---|---|
| Boolean | If true, allows multiple task instances to run concurrently | No* |
| Boolean | If true, removes this setting | No* |
*Exactly one must be specified.
alterState - Suspend or resume task execution:
Attribute | Type | Description | Required |
|---|---|---|---|
| Boolean | If true, suspends the task | No* |
| Boolean | If true, resumes the task | No* |
*Exactly one of suspend or resume must be true.
alterConfig - Modify task configuration:
Attribute | Type | Description | Required |
|---|---|---|---|
| String | JSON configuration string | No* |
| Boolean | If true, removes configuration | No* |
*Exactly one must be specified.
alterWhenClause - Modify conditional execution:
Attribute | Type | Description | Required |
|---|---|---|---|
| String | SQL condition that must be true for task to execute | No* |
| Boolean | If true, removes the WHEN clause | No* |
*Exactly one must be specified.
alterOrder - Manage task predecessors (dependencies):
Attribute | Type | Description | Required |
|---|---|---|---|
| String | Space-separated names of predecessor tasks to add | No* |
| String | Space-separated names of predecessor tasks to remove | No* |
*At least one must be specified. Predecessor tasks must exist. Root tasks cannot have predecessors.
alterExecuteAsUser - Change execution context:
Attribute | Type | Description | Required |
|---|---|---|---|
| String | User name for task execution context | No* |
| Boolean | If true, removes execute as user setting | No* |
*Exactly one must be specified.
alterFinalize - Set or remove finalizer task:
Attribute | Type | Description | Required |
|---|---|---|---|
| String | Name of finalizer task | No* |
| Boolean | If true, removes finalize setting | No* |
*Exactly one must be specified.
alterTargetCompletionInterval - Set target completion time (serverless tasks):
Attribute | Type | Description | Required |
|---|---|---|---|
| String | Target interval (e.g., | No* |
| Boolean | If true, removes target completion interval | No* |
*Exactly one must be specified.
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:pro-snowflake="http://www.liquibase.org/xml/ns/pro-snowflake"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd
http://www.liquibase.org/xml/ns/pro-snowflake
http://www.liquibase.org/xml/ns/pro-snowflake/liquibase-pro-snowflake-latest.xsd">
<!-- Alter comment -->
<changeSet id="alter-task-comment" author="examples">
<pro-snowflake:alterTask taskName="MY_TASK" ifExists="true">
<pro-snowflake:alterComment newComment="Updated task comment"/>
</pro-snowflake:alterTask>
</changeSet>
<!-- Alter schedule -->
<changeSet id="alter-task-schedule" author="examples">
<pro-snowflake:alterTask taskName="MY_TASK" ifExists="true">
<pro-snowflake:alterSchedule newSchedule="15 MINUTES"/>
</pro-snowflake:alterTask>
</changeSet>
<!-- Alter tags -->
<changeSet id="alter-task-tags" author="examples">
<pro-snowflake:alterTask taskName="MY_TASK" ifExists="true">
<pro-snowflake:alterTags>
<pro-snowflake:setTags>
<pro-snowflake:entry key="environment" value="production"/>
<pro-snowflake:entry key="department" value="engineering"/>
</pro-snowflake:setTags>
</pro-snowflake:alterTags>
</pro-snowflake:alterTask>
</changeSet>
<!-- Alter session parameters -->
<changeSet id="alter-task-session-params" author="examples">
<pro-snowflake:alterTask taskName="MY_TASK" ifExists="true">
<pro-snowflake:alterSessionParams>
<pro-snowflake:setSessionParams>
<pro-snowflake:entry key="QUERY_TAG" value="my_task"/>
<pro-snowflake:entry key="STATEMENT_TIMEOUT_IN_SECONDS" value="3600"/>
</pro-snowflake:setSessionParams>
</pro-snowflake:alterSessionParams>
</pro-snowflake:alterTask>
</changeSet>
<!-- Alter contacts -->
<changeSet id="alter-task-contacts" author="examples">
<pro-snowflake:alterTask taskName="MY_TASK" ifExists="true">
<pro-snowflake:alterContacts>
<pro-snowflake:setContacts>
<pro-snowflake:entry key="support" value="support_contact"/>
<pro-snowflake:entry key="steward" value="admin_contact"/>
</pro-snowflake:setContacts>
</pro-snowflake:alterContacts>
</pro-snowflake:alterTask>
</changeSet>
<!-- Alter AS clause (SQL definition) -->
<changeSet id="alter-task-definition" author="examples">
<pro-snowflake:alterTask taskName="MY_TASK" ifExists="true">
<pro-snowflake:alterAsClause>
<pro-snowflake:newAsClause>SELECT 2 AS new_result</pro-snowflake:newAsClause>
</pro-snowflake:alterAsClause>
</pro-snowflake:alterTask>
</changeSet>
<!-- Alter warehouse -->
<changeSet id="alter-task-warehouse" author="examples">
<pro-snowflake:alterTask taskName="MY_TASK" ifExists="true">
<pro-snowflake:alterWarehouse newWarehouseName="LARGE_WH"/>
</pro-snowflake:alterTask>
</changeSet>
<!-- Alter state: suspend -->
<changeSet id="suspend-task" author="examples">
<pro-snowflake:alterTask taskName="MY_TASK" ifExists="true">
<pro-snowflake:alterState suspend="true"/>
</pro-snowflake:alterTask>
</changeSet>
<!-- Alter state: resume -->
<changeSet id="resume-task" author="examples">
<pro-snowflake:alterTask taskName="MY_TASK" ifExists="true">
<pro-snowflake:alterState resume="true"/>
</pro-snowflake:alterTask>
</changeSet>
<!-- Alter config -->
<changeSet id="alter-task-config" author="examples">
<pro-snowflake:alterTask taskName="MY_TASK" ifExists="true">
<pro-snowflake:alterConfig newConfig='{"key": "value"}'/>
</pro-snowflake:alterTask>
</changeSet>
<!-- Alter WHEN clause -->
<changeSet id="alter-task-when" author="examples">
<pro-snowflake:alterTask taskName="MY_TASK" ifExists="true">
<pro-snowflake:alterWhenClause>
<pro-snowflake:newWhenClause>TRUE</pro-snowflake:newWhenClause>
</pro-snowflake:alterWhenClause>
</pro-snowflake:alterTask>
</changeSet>
<!-- Alter order: add predecessors -->
<changeSet id="add-predecessors" author="examples">
<pro-snowflake:alterTask taskName="CHILD_TASK" ifExists="true">
<pro-snowflake:alterOrder>
<pro-snowflake:newAfter>PARENT_TASK_1 PARENT_TASK_2</pro-snowflake:newAfter>
</pro-snowflake:alterOrder>
</pro-snowflake:alterTask>
</changeSet>
<!-- Alter order: remove predecessors -->
<changeSet id="remove-predecessors" author="examples">
<pro-snowflake:alterTask taskName="CHILD_TASK" ifExists="true">
<pro-snowflake:alterOrder>
<pro-snowflake:removeAfter>PARENT_TASK_1</pro-snowflake:removeAfter>
</pro-snowflake:alterOrder>
</pro-snowflake:alterTask>
</changeSet>
<!-- Unset comment -->
<changeSet id="unset-comment" author="examples">
<pro-snowflake:alterTask taskName="MY_TASK" ifExists="true">
<pro-snowflake:alterComment unsetComment="true"/>
</pro-snowflake:alterTask>
</changeSet>
<!-- Unset tags -->
<changeSet id="unset-tags" author="examples">
<pro-snowflake:alterTask taskName="MY_TASK" ifExists="true">
<pro-snowflake:alterTags>
<pro-snowflake:unsetTags>environment department</pro-snowflake:unsetTags>
</pro-snowflake:alterTags>
</pro-snowflake:alterTask>
</changeSet>
</databaseChangeLog>