What you will be able to do
- Trigger, schedule and speed up consumer upgrades through release directives, UPGRADE_AFTER and ALTER APPLICATION ... UPGRADE
- Write setup scripts that stay compatible with the previous version and recover from failed upgrades
- Explain what reverts and what does not when an upgrade fails, including services in apps with containers
- Configure release directives that respect consumer-controlled maintenance policies and an upgrade deadline
1.How a release directive change triggers an upgrade
Consumers never pull a new version on their own initiative. The provider pushes it. When you point a release directive at a different version or patch, Snowflake puts every affected installed app in a queue and upgrades each one as resources allow. Across many consumers this can take a while. You can ask consumers to upgrade manually to speed things up, but a consumer can only do so before Snowflake has started upgrading their app.
ALTER APPLICATION PACKAGE my_application_package
MODIFY RELEASE CHANNEL DEFAULT
SET DEFAULT RELEASE DIRECTIVE
VERSION = v2
PATCH = 0;Checkpoint 1 of 8· Fill the gap
Which keyword does a consumer use to upgrade an installed app before the automated upgrade reaches it?
ALTER APPLICATION <name> ? ALTER APPLICATION <name> UPGRADE upgrades the app to whatever the release directive on its channel specifies. It only works before the automated upgrade has started on that app.
Source: docs.snowflake.comThe full provider workflow puts testing before the directive change, because the directive change is what reaches consumers. For apps published through Cross-Cloud Auto-Fulfillment, consumers in remote regions may not see the change until the listing refreshes. The APPLICATION_STATE view in the Data Sharing Usage schema shows the state of each installed instance.
Checkpoint 2 of 8· Put it in order
Put the provider's upgrade workflow in order
- 1.Install the app in your test account and test it
- 2.Update the app to include the new features
- 3.If two versions are already defined, make sure no consumers run the one being replaced, then drop it
- 4.Update the release directive to start the automated upgrade
- 5.Create the new version or patch in the release channel
The directive change is last because it starts the automated upgrade for every installed instance. Space for the new version has to exist before you create it.
“Update the release directive for the version or patch. This initiates an automated upgrade”Source: docs.snowflake.com
Sources1
2.Scheduling upgrades with UPGRADE_AFTER
To delay an upgrade, add UPGRADE_AFTER when you set a default or custom release directive. The timestamp is the earliest the upgrade can start. The real start may be later, depending on how many apps and consumer accounts are involved. A timestamp that has already passed schedules the upgrade right away, the same as leaving the clause out. UPGRADE_AFTER only works in the same statement that sets VERSION and PATCH. You cannot use it to change only the time.
ALTER APPLICATION PACKAGE hello_snowflake_package MODIFY RELEASE CHANNEL DEFAULT SET DEFAULT RELEASE DIRECTIVE VERSION = 'v1_0' PATCH = '2' UPGRADE_AFTER = '2025-04-06T11:00:00Z'Checkpoint 3 of 8· Check yourself
A directive already points at v1_0 patch 2 with an UPGRADE_AFTER date. The provider wants to push that date back a week. What must the statement include?
UPGRADE_AFTER is only valid while you are setting the version and patch, so you restate them with the new timestamp.
“This clause can’t be used to modify only the upgrade time and date.”Source: docs.snowflake.com
Checkpoint 4 of 8· Exam question
A provider runs ALTER APPLICATION PACKAGE ... ADD VERSION to publish a new version of a Snowflake Native App. Which clause is required to point Snowflake at the stage location containing the version's files?
Correct answer: A — USING
- A. Correct: the USING clause supplies the stage path where the version's manifest, setup script, and other files live.
- B. Incorrect: LABEL only sets an optional display name for consumers and does not point to a stage location.
- C. Incorrect: FOR VERSION is used with ADD PATCH to identify the parent version, not with ADD VERSION to locate files.
- D. Incorrect: WITH STAGE is not valid syntax for this command; the stage location is supplied through USING.
Sources1
3.Version dependencies and rollback
Versions depend on each other in a simple chain. Snowflake allows only the previous version to be active. Before upgrading anyone to v3, it moves every v1 install to v2. That means a setup script only has to handle the difference from the version just before it. Code from the previous version can still be running during an upgrade, so it must cope with state changes the new version makes. State changes belong in versions, never in patches.
Setup scripts must also be self-contained. A consumer can install v3 without ever having had v2, so v3 must contain every CREATE and ALTER needed to build the app from nothing. They must also be idempotent: Snowflake reruns a failed setup script from the start, and upgrades can be retried. Use CREATE IF NOT EXISTS or CREATE OR ALTER for tables, ALTER TABLE ADD COLUMN IF NOT EXISTS for new columns, and CREATE OR REPLACE only for stateless objects such as procedures. Application roles are not versioned. Recreating one with CREATE OR REPLACE APPLICATION ROLE drops the grants consumers gave it.
When an upgrade fails, objects in a versioned schema go back to the previous version. Services in apps with containers do not. They live outside versioned schemas, so a successful ALTER SERVICE has already upgraded the service before a later step fails. To handle this, the manifest can name a version initializer, a callback stored procedure. It starts or upgrades services and can roll them back if the upgrade fails. Calling SYSTEM$WAIT_FOR_SERVICES in the setup script pauses it until the named services are READY, one of them FAILED, or the timeout passes.
| Object | On a failed upgrade | Provider's tool |
|---|---|---|
| Objects in a versioned schema | Revert to the previous version of the app | Versioned schemas |
| Services created or altered by CREATE SERVICE / ALTER SERVICE | Stay on the new version's specification | Version initializer to roll back; SYSTEM$WAIT_FOR_SERVICES to wait |
| Application roles | Not versioned; dropping a role or revoking a grant can break access | CREATE APPLICATION ROLE IF NOT EXISTS |
Checkpoint 5 of 8· Check yourself
An upgrade of an app with containers fails partway through the setup script, after ALTER SERVICE has succeeded. What state is the app left in?
Versioned-schema objects revert on error. Services are not in versioned schemas, so they stay upgraded unless a version initializer rolls them back.
“If an error occurs during upgrade, the objects within the versioned schema revert back to the previous version of the app.”Source: docs.snowflake.com
Checkpoint 6 of 8· Check yourself
A provider wants to retire the old version from a release channel once an upgrade has gone out. When is that possible?
An upgraded app may still be running code from the previous version. Every such run must finish, and every failed upgrade must be fixed, before the version can be removed.
“Providers cannot remove the previous version of the app from the release channel until all running code from the previous version has completed.”Source: docs.snowflake.com
4.Consumer-controlled maintenance policies
The exam guide marks this feature as untested until it has been in Public Preview for three months, but it is part of the objective.
With a maintenance policy, the consumer decides when upgrades happen. On the provider side, you set UPGRADE_IN_MAINTENANCE_WINDOW = TRUE on the release directive. This requires an UPGRADE_DEADLINE, so consumers cannot postpone forever. Once the deadline passes, the upgrade goes ahead regardless of the policy. You cannot combine this with UPGRADE_AFTER in the same command; trying to set both returns an error.
ALTER APPLICATION PACKAGE my_app_package
MODIFY RELEASE CHANNEL DEFAULT
SET DEFAULT RELEASE DIRECTIVE
VERSION = v1_0
PATCH = 2
UPGRADE_IN_MAINTENANCE_WINDOW = TRUE
UPGRADE_DEADLINE = '2026-2-10T10:00:00Z';For apps that use Snowpark Container Services, setting AUTOMATIC_APPLICATION_MAINTENANCE = TRUE on the package puts compute pool node maintenance in the same window. The app upgrades first, then the node maintenance runs. Consumers without a policy are upgraded during the default system maintenance window.
On the consumer side, CREATE MAINTENANCE POLICY sets a cron schedule. A policy only defines a start time, not an end time or duration. Each account or app can have only one policy.
CREATE MAINTENANCE POLICY my_maintenance_policy
SCHEDULE = 'USING CRON 0 2 * * SAT UTC'
COMMENT = 'Weekly Saturday maintenance policy';| Task | Command | Privilege |
|---|---|---|
| Create a policy | CREATE MAINTENANCE POLICY | CREATE MAINTENANCE POLICY on the schema |
| Apply to every app in the account | ALTER ACCOUNT SET MAINTENANCE POLICY ... FOR ALL APPLICATIONS | APPLY MAINTENANCE POLICY on the account |
| Apply to one app | ALTER APPLICATION my_app SET MAINTENANCE POLICY ... | APPLY MAINTENANCE POLICY on the account |
| Use or view a specific policy | SHOW MAINTENANCE POLICIES / DESCRIBE MAINTENANCE POLICY | APPLY or OWNERSHIP on the maintenance policy |
Checkpoint 7 of 8· Check yourself
A provider sets a release directive with UPGRADE_AFTER and UPGRADE_IN_MAINTENANCE_WINDOW = TRUE in the same command. What happens?
These two parameters cannot be set together. Use UPGRADE_DEADLINE with UPGRADE_IN_MAINTENANCE_WINDOW instead.
“You can’t set the UPGRADE_AFTER and UPGRADE_IN_MAINTENANCE_WINDOW parameters at the same time.”Source: docs.snowflake.com
Checkpoint 8 of 8· Exam question
A provider has version V2 with patches 0 and 1 already published. The provider runs: ALTER APPLICATION PACKAGE my_pkg ADD PATCH FOR VERSION V2 USING '@stage.schema.stage/v2' without specifying a patch number. What patch number will Snowflake assign?
Correct answer: A — Patch 2, because Snowflake auto-increments the patch number when it is omitted.
- A. Correct: when the patch number is left out of ADD PATCH, Snowflake auto-increments from the highest existing patch number for that version, so patch 2 follows patches 0 and 1.
- B. Incorrect: omitting the patch number does not restart numbering at zero; it continues the sequence forward from the existing highest patch.
- C. Incorrect: the patch number is optional in this command precisely so that Snowflake can auto-increment it.
- D. Incorrect: reusing an existing patch number would overwrite it rather than add a new patch, which is not the auto-increment behavior.
Exam traps
Each one states something that sounds right. Open it to see what is actually true.
1.A consumer maintenance policy lets the consumer postpone a provider's upgrade indefinitely.Why is that wrong?
UPGRADE_DEADLINE is required when UPGRADE_IN_MAINTENANCE_WINDOW is TRUE. Once the deadline passes, the upgrade goes ahead regardless of the policy.
Covered in Consumer-controlled maintenance policies
2.Using CREATE OR REPLACE APPLICATION ROLE in the setup script is a safe way to keep roles current across versions.Why is that wrong?
Application roles are not versioned. OR REPLACE drops and recreates the role, so account-level roles that consumers granted to it would have to be granted again. Use CREATE APPLICATION ROLE IF NOT EXISTS.
Covered in Version dependencies and rollback
3.A consumer can run ALTER APPLICATION ... UPGRADE at any time, even after the automated upgrade of their app has started.Why is that wrong?
Manual upgrade is a way to get ahead of the queue. Once Snowflake has started upgrading an app, the consumer can no longer upgrade it manually.
Covered in How a release directive change triggers an upgrade
Practise it for real
Release a new version through QA in your own provider account, then upgrade a test install to it.
1.Stage the new version's files, including its own manifest and setup script, then run ALTER APPLICATION PACKAGE my_app_package REGISTER VERSION V1 USING '@stage/path';
Why: With release channels enabled, a version has to be registered before it can go into a channel.
You should see: Version V1 with patch 0 exists in the package and is not in any channel yet.
2.Run ALTER APPLICATION PACKAGE my_app_package MODIFY RELEASE CHANNEL QA ADD VERSION V1;
Why: Putting the version in QA lets you test it without starting the security scan.
You should see: SHOW RELEASE CHANNELS IN APPLICATION PACKAGE my_app_package lists V1 under QA.
3.Set the QA default release directive to VERSION=V1 PATCH=0, then run CREATE APPLICATION my_app FROM APPLICATION PACKAGE my_app_package USING RELEASE CHANNEL QA; with a role that has CREATE PREVIEW APPLICATION.
Why: A directive must point at the version before you can install it from the channel.
You should see: my_app installs and its setup script finishes without errors.
4.Add a patch with ALTER APPLICATION PACKAGE my_app_package ADD PATCH FOR VERSION V1 USING the patch's stage path, point the QA directive at the new patch, then run ALTER APPLICATION my_app UPGRADE.
Why: This walks through a patch release and a consumer-triggered upgrade, and checks that the setup script can safely run again on an existing install.
You should see: Patch 1 is created automatically, and my_app upgrades to it without errors.
Stuck? Get a nudge
If the upgrade fails on a CREATE statement, check whether you used plain CREATE TABLE where you needed CREATE TABLE IF NOT EXISTS.
Sources
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“When the provider initiates an upgrade, Snowflake adds each app to be upgraded to a queue.”
↩︎ How a release directive change triggers an upgrade“After the upgrade process begins on an app, consumers can no longer manually upgrade the app.”
↩︎ How a release directive change triggers an upgrade“If the timestamp has already passed the upgrade is immediately scheduled.”
↩︎ Scheduling upgrades with UPGRADE_AFTER“This is the earliest date and time when the upgrade can begin.”
↩︎ Scheduling upgrades with UPGRADE_AFTER“The setup script is only backwards compatible with the most recent version of the app.”
↩︎ Version dependencies and rollback“After the upgrade process begins on an app, consumers can no longer manually upgrade the app.”
↩︎ Exam trap 3“Update the release directive for the version or patch. This initiates an automated upgrade”
↩︎ Checkpoint“This clause can’t be used to modify only the upgrade time and date.”
↩︎ Checkpoint“Providers cannot remove the previous version of the app from the release channel until all running code from the previous version has completed.”
↩︎ Checkpoint - 2.
“If the setup script fails during installation, Snowflake reruns the setup script from the beginning.”
↩︎ Version dependencies and rollback“Snowflake recommends using CREATE OR REPLACE only for stateless objects, such as functions or procedures, but not for stateful objects, such as tables.”
↩︎ Version dependencies and rollback“Because services are not created within versioned schemas, a service is upgraded as soon as the CREATE SERVICE or ALTER SERVICE command run successfully.”
↩︎ Version dependencies and rollback“Use the version initializer function to rollback service upgrades to the previous version if the upgrade fails.”
↩︎ Version dependencies and rollback“Avoid using CREATE OR REPLACE APPLICATION ROLE. Instead, use CREATE APPLICATION ROLE IF NOT EXISTS.”
↩︎ Exam trap 2“because only two versions of an app can exist at one time, version v3 does not have to be compatible with version v1.”
↩︎ Prediction“If an error occurs during upgrade, the objects within the versioned schema revert back to the previous version of the app.”
↩︎ Checkpoint - 3.https://docs.snowflake.com/en/developer-guide/native-apps/consumer-maintenance-policies-providerOfficial docs
“The UPGRADE_DEADLINE parameter is required when UPGRADE_IN_MAINTENANCE_WINDOW is set to TRUE.”
↩︎ Consumer-controlled maintenance policies“If the consumer has not set a maintenance policy, the upgrade happens during the default system maintenance window.”
↩︎ Consumer-controlled maintenance policies“After this deadline, the upgrade proceeds regardless of the consumer’s maintenance policy.”
↩︎ Exam trap 1“You can’t set the UPGRADE_AFTER and UPGRADE_IN_MAINTENANCE_WINDOW parameters at the same time.”
↩︎ Checkpoint - 4.https://docs.snowflake.com/en/developer-guide/native-apps/consumer-maintenance-policiesOfficial docs
“Each app or account can only have one maintenance policy set.”
↩︎ Consumer-controlled maintenance policies