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

catalogName

String

Name of the catalog (database) containing the task

No

schemaName

String

Name of the schema containing the task

No

taskName

String

Name of the task to alter

Yes

ifExists

Boolean

If true, uses IF EXISTS clause to avoid errors if task doesn't exist

No

newErrorIntegration

String

Notification integration to call when task encounters errors

No

newSuccessIntegration

String

Notification integration to call when task completes successfully

No

alterComment

Nested

Modify or remove task comment

No

alterSchedule

Nested

Modify or remove task schedule

No

alterTags

Nested

Add or remove tags

No

alterSessionParams

Nested

Set or unset session parameters

No

alterContacts

Nested

Add or remove contacts

No

alterAsClause

Nested

Modify the SQL statement executed by the task

No

alterWarehouse

Nested

Change warehouse settings

No

alterAllowOverlappingExecution

Nested

Control concurrent execution

No

alterState

Nested

Suspend or resume task execution

No

alterConfig

Nested

Modify task configuration

No

alterWhenClause

Nested

Modify conditional execution

No

alterOrder

Nested

Manage task predecessors (dependencies)

No

alterExecuteAsUser

Nested

Change execution context

No

alterFinalize

Nested

Set or remove finalizer task

No

alterTargetCompletionInterval

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

newComment

String

New comment text

No*

unsetComment

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

newSchedule

String

New schedule (e.g., 15 MINUTES, USING CRON 0 9 * * * UTC)

No*

unsetSchedule

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

setTags

MapWrapper

Key-value pairs of tags to set

No*

unsetTags

String

Space-separated tag names to unset (e.g., environment department)

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

setSessionParams

MapWrapper

Key-value pairs of session parameters (e.g., QUERY_TAG, STATEMENT_TIMEOUT_IN_SECONDS)

No*

unsetSessionParams

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

setContacts

MapWrapper

Key-value pairs mapping contact purposes to contact names

No*

unsetContacts

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

newAsClause

String

New SQL statement

Yes

alterWarehouse - Change warehouse settings:

Attribute

Type

Description

Required

newWarehouseName

String

New warehouse name

No*

newUserTaskManagedInitialWarehouseSize

String

Initial warehouse size for serverless tasks

No*

unsetWarehouse

Boolean

If true, removes warehouse assignment

No*

*Exactly one option must be specified.

alterAllowOverlappingExecution - Control concurrent execution:

Attribute

Type

Description

Required

newAllowOverlappingExecution

Boolean

If true, allows multiple task instances to run concurrently

No*

unsetAllowOverlappingExecution

Boolean

If true, removes this setting

No*

*Exactly one must be specified.

alterState - Suspend or resume task execution:

Attribute

Type

Description

Required

suspend

Boolean

If true, suspends the task

No*

resume

Boolean

If true, resumes the task

No*

*Exactly one of suspend or resume must be true.

alterConfig - Modify task configuration:

Attribute

Type

Description

Required

newConfig

String

JSON configuration string

No*

unsetConfig

Boolean

If true, removes configuration

No*

*Exactly one must be specified.

alterWhenClause - Modify conditional execution:

Attribute

Type

Description

Required

newWhenClause

String

SQL condition that must be true for task to execute

No*

unsetWhenClause

Boolean

If true, removes the WHEN clause

No*

*Exactly one must be specified.

alterOrder - Manage task predecessors (dependencies):

Attribute

Type

Description

Required

newAfter

String

Space-separated names of predecessor tasks to add

No*

removeAfter

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

newExecuteAsUser

String

User name for task execution context

No*

unsetExecuteAsUser

Boolean

If true, removes execute as user setting

No*

*Exactly one must be specified.

alterFinalize - Set or remove finalizer task:

Attribute

Type

Description

Required

newFinalize

String

Name of finalizer task

No*

unsetFinalize

Boolean

If true, removes finalize setting

No*

*Exactly one must be specified.

alterTargetCompletionInterval - Set target completion time (serverless tasks):

Attribute

Type

Description

Required

newTargetCompletionInterval

String

Target interval (e.g., 5 MINUTES)

No*

unsetTargetCompletionInterval

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>