What you will be able to do
- Describe what an application package contains and where its artifacts live on the stage
- Read and write the sections of manifest.yml and choose between manifest_version 1 and 2
- Write a rerun-safe SQL setup script whose objects stay internal unless granted to an application role
- Place stateless code in versioned schemas and stateful data in regular schemas, and evolve stateful tables across versions
- Choose between stored procedures, UDFs, UDTFs and external calls when implementing app logic
Key concept
Application package — The provider-side container a Snowflake Native App is installed from. It holds the app's data and logic, and each version brings its own manifest.yml and SQL setup script, which build the app's objects at install and upgrade.
1.What an application package contains
A Snowflake Native App is never installed from loose files. A provider builds an application package, a container that holds the app's data content and application logic, along with the versions and patches defined for the app. Consumers install from that package, and a provider testing the app creates an app from the same package.
Two files define every version. The manifest, manifest.yml, says where the setup script is, which version it describes and how the app is configured. The setup script holds the SQL that creates the app's objects. Each version of an app needs its own copy of both, so version 2 can reshape what version 1 created.
These files and every other artifact live on a named stage that the package can read. You can create a package before any files exist, but you can't develop or test an app until they are uploaded. The manifest must sit at the root of the stage directory. Everything else is addressed by a path relative to that root, such as scripts/setup_script.sql for the setup script or /libraries/echo.py for a code library: the readme, secondary scripts, handler code and container specification files.
Checkpoint 1 of 9· Check yourself
A provider runs CREATE APPLICATION PACKAGE and then uploads the app's files to a named stage the package can read: config/manifest.yml, scripts/setup_script.sql and readme.md. Before they can test the app, what has to change?
The manifest must sit at the root of the stage directory. Every other artifact, including the setup script, is found by a path relative to that root. You can create the package before any files exist; you just can't develop or test the app until the files are uploaded.
“The manifest file must exist at the root of the directory structure on the named stage where other application files are stored.”Source: docs.snowflake.com
2.Manifest sections and manifest_version
The manifest is a YAML file, and its name must be exactly manifest.yml. Only two top-level fields are required. manifest_version selects the format Snowflake uses to read the rest of the file. artifacts points to the code and assets the app needs. Every other block is opt-in, and you add it only when the app needs that capability.
| Field | Required? | What it declares |
|---|---|---|
| manifest_version | Required | The manifest file format; controls which manifest features are available |
| version | Optional | Version metadata: name, patch, label, comment |
| artifacts | Required | setup_script (default setup.sql beside the manifest), readme, default_streamlit, extension_code, container_services |
| configuration | Optional | log_level, trace_level, metric_level, log_event_level, and grant_callback for an app with containers |
| lifecycle_callbacks | Optional | Stored procedures Snowflake runs at lifecycle points, e.g. before_configuration_change |
| privileges | Optional | Privileges requested in the consumer account, each with a description |
| snowflake_database | Optional | Roles requested in the SNOWFLAKE database, such as CORTEX_USER |
| references | Optional | Requested references to objects in the consumer account |
Compatibility depends on manifest_version. Version 1 supports both current and legacy Native App functionality. Version 2 adds features, most importantly automated granting of privileges: privileges listed in the privileges block are granted to the app automatically when it is installed.
manifest_version: 2
version:
name: v1
artifacts:
readme: readme.md
setup_script: setup.sql
privileges:
- CREATE TABLE:
description: "Allows the app to create tables in the consumer account"
- CREATE WAREHOUSE:
description: "Allows the app to create warehouses in the consumer account"Choosing version 2 is a security decision, not just a format choice. During installation, Snowsight shows the consumer which privileges the app requests. By installing, the consumer agrees that those privileges may also be granted during later upgrades without being asked again. Consumers who want limits can apply feature policies that restrict which objects the app can create. Version 2 still uses a setup script and a privileges block, and Snowflake's own example manifest for an app with containers declares manifest_version: 2.
The optional version block labels a release with name, patch, label and comment. Versions and patches defined with CREATE APPLICATION PACKAGE or ALTER APPLICATION PACKAGE take precedence over it.
Checkpoint 2 of 9· Fill the gap
This manifest should make Snowflake grant CREATE TABLE and CREATE WAREHOUSE to the app automatically when it is installed. Which top-level block fills the blank?
manifest_version: 2
version:
name: v1
artifacts:
readme: readme.md
setup_script: setup.sql
? :
- CREATE TABLE:
description: "Allows the app to create tables in the consumer account"
- CREATE WAREHOUSE:
description: "Allows the app to create warehouses in the consumer account"With manifest_version 2, the privileges listed in the privileges block are granted to the app automatically at install. By installing, the consumer also agrees that these privileges can be granted during later upgrades without being asked again. references asks for consumer objects, snowflake_database asks for roles such as CORTEX_USER, and configuration sets log and trace levels.
Checkpoint 3 of 9· Exam question
A provider is deciding which manifest_version to declare for a new Native App. What is the key practical difference between manifest_version 1 and manifest_version 2 that the provider must account for?
Correct answer: A — manifest_version 2 enables automated privilege granting, which carries security implications the provider must evaluate before adopting it
- A. Manifest version 2 introduces automated granting of certain requested privileges during install, which reduces friction but also means privileges can be granted without an explicit consumer click, so it must be evaluated carefully.
- B. The setup script remains required in both manifest versions; manifest_version 2 does not eliminate it or move logic into the manifest file itself.
- C. Container-based artifacts are not restricted to manifest_version 1; the version distinction is about privilege-granting behavior, not container support.
- D. Requested privileges are still declared in the manifest's privileges section under both versions; manifest_version 2 does not move this to the listing profile.
3.The setup script: SQL that builds the app at install and upgrade
The setup script is the SQL file the manifest points to, and running it is what creates the app. It runs when a consumer installs or upgrades the app, and when a provider creates or upgrades an app while testing the package. It creates what the app needs: schemas, tables, views, stored procedures and application roles. The script is SQL only. Python or Java logic enters the app as procedures and functions that the SQL creates, never as the script itself. Metadata such as artifacts, privileges and references belongs in the manifest.
Everything the script creates is internal to the app. A provider makes objects visible by granting them to application roles. The setup script creates those roles too, and each one is automatically granted to the role that owns the app. Role design is covered under application roles and privileges. While testing, a provider can still inspect internal objects by using development mode.
The script runs without the usual session conveniences. USE DATABASE, USE SCHEMA, USE ROLE and USE SECONDARY ROLES are all forbidden. CREATE SCHEMA doesn't switch the context either, so every object name must be schema-qualified: CREATE TABLE IF NOT EXISTS app_config.params(...), not a bare params. Objects should also stay inside the app. Suppose the script creates a view in an outside database that reads an app table. That view breaks once the consumer takes ownership of the database and drops the app.
Large scripts can be split into several files. The primary script named in the manifest calls secondary scripts with EXECUTE IMMEDIATE FROM. They run in the order they are encountered, and they can make further calls of their own. Paths are case-sensitive: / starts at the app root, ./ at the current script's directory, and ../ at its parent. At app runtime only the / form is allowed, and event logging doesn't work in scripts called this way.
Write the script so it can be rerun safely. It may run several times during one install or upgrade, for example when a failed run is retried. Create objects with CREATE OR REPLACE or CREATE IF NOT EXISTS, and choose between them deliberately, because replacing an object silently drops the grants on it:
CREATE OR REPLACE PROCEDURE app_state.proc()...;
GRANT USAGE ON PROCEDURE app_state.proc()
TO APPLICATION ROLE app_user;If the script fails between those two statements, consumers lose access to the procedure. Some failures can't be fixed by a retry, such as a syntax error. In that case access stays lost until a new version or patch restores the grant.
Checkpoint 4 of 9· Check yourself
During an upgrade, the new setup script runs CREATE OR REPLACE PROCEDURE app_state.proc(). The next statement, the GRANT USAGE to APPLICATION ROLE app_user, has a syntax error, so the script fails at that point. What happens to consumers who use the procedure through app_user?
CREATE OR REPLACE removes the grants that were on the procedure it replaces. A syntax error can't be fixed by retrying, so the GRANT never runs again. Access stays lost until a new version or patch restores the grant.
“the consumer cannot access the procedure until the app is upgraded to a new version or patch and the grant is restored.”Source: docs.snowflake.com
Checkpoint 5 of 9· Exam question
What is the primary role of the setup script within a Snowflake Native App application package?
Correct answer: A — It contains the SQL statements executed to create the objects (procedures, functions, roles, views) that make up the app when it is installed or upgraded
- A. The setup script is a SQL script executed during install or upgrade that creates the app's internal objects, such as procedures, functions, views, and application roles, inside the application object.
- B. Declaring artifacts, privileges, and references is the job of manifest.yml, not the setup script, which is purely SQL that builds objects.
- C. The setup script does not store compiled binaries; container images are pushed separately to an image repository and referenced by the service specification.
- D. Version and patch history is tracked by the application package's metadata and release channels, not written into the setup script itself.
Sources4
4.Versioned schemas for code, regular schemas for state
Each upgrade forces a decision about every object the setup script creates: rebuild it for the new version, or carry it over untouched? That decision sorts objects into two kinds. Stateless objects are the app's code, such as stored procedures, user-defined functions and Streamlit apps. They are recreated for each new version or patch and belong in a versioned schema. Stateful objects, such as a configuration table or data the app collects while running, carry over from one version to the next and belong in a regular schema.
Take a compliance table that gets a new row on every consumer action. It is stateful: its rows must survive every upgrade unchanged. It therefore goes in a regular schema and is created with CREATE TABLE IF NOT EXISTS, so a rerun never wipes it. Putting it in a versioned schema, or recreating it with CREATE OR REPLACE to keep it in step with the new version, is exactly what destroys the history. Versioned schemas do not archive rows. They exist to run several versions of code side by side.
Running versions side by side is what a versioned schema is for. Internally it holds one subschema per app version, and a query started by an object inside it is pinned to that version. Suppose v1 is still running a long query when an upgrade to v2 arrives. The app's upgrade state becomes COMPLETE, and v1 moves to FINALIZING until its jobs finish. Consumers never see the subschemas: SHOW OBJECTS on a versioned schema lists only the objects of the version they have installed.
| Question | Versioned schema | Regular schema |
|---|---|---|
| What goes in it | Stateless code: stored procedures, user-defined functions, Streamlit apps | Stateful objects: configuration tables, data collected while the app runs |
| What happens on upgrade | Recreated for each new version or patch | Carried over from one version or patch to the next |
| How the setup script creates it | CREATE OR ALTER VERSIONED SCHEMA | CREATE SCHEMA IF NOT EXISTS |
| Tasks, tags, masking policies, Snowpark Container Services, application roles | Not supported | Where they must be created |
Versioned schemas exist only inside an application object, and only the setup script can create them. Always use CREATE OR ALTER VERSIONED SCHEMA so the schema stays compatible across versions and patches. Each version owns its own copy of the contents, so objects inside must be recreated every time with CREATE OR REPLACE or CREATE IF NOT EXISTS. Grants and future grants aren't supported in versioned schemas. A versioned schema also can't be the source or target of a clone, and it can't be dropped, because dropping it would remove every version's objects and break queries still running on older versions. Objects in either kind of schema can refer to objects in the other.
Changing a stateful table between versions uses the same rerun-safe approach. The script first tries to create the table in its newest shape, which only takes effect on a fresh install. It then alters the table to add anything an older version lacked:
CREATE SCHEMA IF NOT EXISTS stateful_object;
CREATE TABLE IF NOT EXISTS stateful_object.config (
config_param STRING,
config_value STRING,
default_value STRING,
modified_on TIMESTAMP);
ALTER TABLE stateful_object.config
ADD COLUMN IF NOT EXISTS modified_on TIMESTAMP;Checkpoint 6 of 9· Match them up
A setup script for v2 of an app creates the objects below. Match each object to where it belongs and how it behaves on upgrade.
Tap a term, then the definition that fits it.
Stateless code such as procedures goes in a versioned schema and is rebuilt for each version. Stateful tables go in a regular schema and are created only if they don't exist, so their rows survive upgrades. Tasks, tags, masking policies, Snowpark Container Services and application roles aren't supported in versioned schemas, so they must go in a normal schema.
“Tasks are not supported in versioned schemas.”Source: docs.snowflake.com
Checkpoint 7 of 9· Exam question
A provider's Native App writes a row to a table every time a consumer performs an action, for compliance auditing. These rows must remain intact and unaffected when the app is upgraded to a new version. In which schema type should this table be created, and why?
Correct answer: A — In a regular (non-versioned) schema, because objects there are not recreated during an upgrade and their data persists unchanged across versions
- A. Regular schema objects are not touched by the setup script's version-scoped recreation logic, so stateful data such as an audit table survives upgrades untouched. This is exactly why stateful objects belong outside versioned schemas.
- B. Versioned schemas do not perform any automatic archiving of rows; they only manage recreating stateless code objects per version. This mischaracterizes the mechanism entirely.
- C. Row access policies can be applied to objects in either schema type, so this is not a valid differentiator between versioned and regular schemas.
- D. Using CREATE OR REPLACE on a table would drop and recreate it, destroying the accumulated audit history, which is the opposite of what the requirement calls for.
Sources5
5.Procedures, UDFs, UDTFs and external functions as app logic
App logic is code that the setup script creates in SQL. Stored procedures, UDFs and UDTFs are all stateless, so they go in a versioned schema and are rebuilt with each version. This setup script statement creates a Python procedure whose handler file ships inside the package:
CREATE OR REPLACE PROCEDURE stateless_object.py_echo_proc(STR string)
RETURNS STRING
LANGUAGE PYTHON
RUNTIME_VERSION=3.12
PACKAGES=('snowflake-snowpark-python')
HANDLER='echo.echo_proc'
IMPORTS=('/libraries/echo.py');The IMPORTS path starts at the package root, and that is the only kind of import allowed. The setup script may not create Snowpark UDFs or procedures that IMPORT files from a named stage. It may not import code files from a stage in CREATE FUNCTION, and it may not call procedures, functions or anonymous blocks that refer to code outside the application package. All of the logic ships with the version. The extension_code setting under artifacts enables or disables Java, Python and Scala. The setup script also may not create or invoke EXECUTE AS CALLER procedures, so none of the procedures it defines run as caller's-rights procedures.
Choose the object type by who calls it and what it does:
- Stored procedures handle actions, and anything Snowflake calls back into must be one. Reference
register_callbackhandlers, the containergrant_callback,lifecycle_callbacksentries and wrappers around CREATE SERVICE are all stored procedures. - UDFs and UDTFs hold computation that consumers are given through an application role. They follow the same versioned-schema placement and import rules as procedures.
- External functions and other outbound calls are for logic that must reach outside Snowflake. That path depends on integration objects in the consumer account. API INTEGRATION and EXTERNAL ACCESS INTEGRATION are among the object types an app can request USAGE on through a reference, so the code ships in the package while the consumer binds the integration at install.
Checkpoint 8 of 9· Fill the gap
In a setup script, a Python procedure gets its handler code through IMPORTS. Which value fills the blank so that the setup script is allowed to run this statement?
CREATE OR REPLACE PROCEDURE stateless_object.py_echo_proc(STR string)
RETURNS STRING
LANGUAGE PYTHON
RUNTIME_VERSION=3.12
PACKAGES=('snowflake-snowpark-python')
HANDLER='echo.echo_proc'
IMPORTS=( ? );The handler file has to ship inside the application package, and the path starts at the package root. A setup script may not create UDFs or procedures that IMPORT files from a named stage, and it may not call code from outside the package.
Source: docs.snowflake.comCheckpoint 9 of 9· Check yourself
A provider wants logic that Snowflake runs on its own before a consumer changes the app's configuration (before_configuration_change). What should the setup script create for that logic?
Anything Snowflake calls back into must be a stored procedure, and lifecycle_callbacks entries point to procedures. Procedures are stateless code, so they go in the versioned schema. Tasks aren't supported in versioned schemas, and a setup script can't create EXECUTE AS CALLER procedures.
“The lifecycle_callbacks field (block, optional) defines stored procedures that Snowflake runs at specific points in the Snowflake Native App lifecycle.”Source: docs.snowflake.com
Sources
(6)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“Each version of an app requires its own version of the manifest and setup script:”
↩︎ What an application package contains“An application package is a container that encapsulates the data content and application logic used by a Snowflake Native App.”
↩︎ Key concept - 2.
“The manifest file must exist at the root of the directory structure on the named stage where other application files are stored.”
↩︎ What an application package contains“This version of the manifest file provides support for additional features, including automated granting of privileges.”
↩︎ Manifest sections and manifest_version“they agree that the app may be granted these privileges during upgrades without requiring additional consent.”
↩︎ Exam trap 1 - 3.
“Versions and patches defined using the CREATE APPLICATION PACKAGE or ALTER APPLICATION PACKAGE commands take precedence over those defined in the manifest file.”
↩︎ Manifest sections and manifest_version“The lifecycle_callbacks field (block, optional) defines stored procedures that Snowflake runs at specific points in the Snowflake Native App lifecycle.”
↩︎ Checkpoint - 4.
“The setup script only supports using SQL commands. Other languages are not supported.”
↩︎ The setup script: SQL that builds the app at install and upgrade“Database objects created by the setup script are internal to the app.”
↩︎ The setup script: SQL that builds the app at install and upgrade“The setup script can be run multiple times during installation and upgrade.”
↩︎ The setup script: SQL that builds the app at install and upgrade“Creating Snowpark user-defined functions (UDFs) or procedures that use IMPORT to include files on a named stage.”
↩︎ Procedures, UDFs, UDTFs and external functions as app logic“the CREATE OR REPLACE statement replaces an existing procedure, which implicitly removes privileges that had been previously granted to that procedure.”
↩︎ Exam trap 2“When a consumer installs an app, by default, these objects are invisible and inaccessible to the consumer account directly.”
↩︎ Prediction“the consumer cannot access the procedure until the app is upgraded to a new version or patch and the grant is restored.”
↩︎ Checkpoint - 5.
“Stateful objects are shared from one version or patch of the app to another.”
↩︎ Versioned schemas for code, regular schemas for state“You should always include the CREATE OR ALTER version of this command to ensure that versioned schemas are compatible across versions and patches.”
↩︎ Versioned schemas for code, regular schemas for state“Stateless objects are typically the code of the app, including stored procedures, user-defined functions, Streamlit apps, and similar content.”
↩︎ Procedures, UDFs, UDTFs and external functions as app logic“you must create them in a normal schema.”
↩︎ Exam trap 3“Tasks are not supported in versioned schemas.”
↩︎ Checkpoint - 6.
“API INTEGRATION | USAGE”
↩︎ Procedures, UDFs, UDTFs and external functions as app logic