CREATE APPLICATION¶

Creates a new application object using an application package or listing. This command is used by providers to test an application package before publishing a Snowflake Native App.

When this command runs, it runs the setup script of the application package.

See also:

ALTER APPLICATION, DESCRIBE APPLICATION, DROP APPLICATION, SHOW APPLICATIONS

Syntax¶

CREATE APPLICATION <name> FROM APPLICATION PACKAGE <package_name>
   [ COMMENT = '<string_literal>' ]
   [ [ WITH ] TAG ( <tag_name> = '<tag_value>' [ , ... ] ) ]

CREATE APPLICATION <name> FROM APPLICATION PACKAGE <package_name>
  USING <path_to_version_directory>
  [ DEBUG_MODE = { TRUE | FALSE } ]
  [ COMMENT = '<string_literal>' ]
  [ [ WITH ] TAG ( <tag_name> = '<tag_value>' [, ...] ) ]


CREATE APPLICATION <name> FROM APPLICATION PACKAGE <package_name>
  USING VERSION  <version_identifier> [ PATCH <patch_num> ]
  [ DEBUG_MODE = { TRUE | FALSE } ]
  [ COMMENT = '<string_literal>' ]
  [ [ WITH ] TAG ( <tag_name> = '<tag_value>' [ , ... ] ) ]

CREATE APPLICATION <name> FROM LISTING <listing_name>
   [ COMMENT = '<string_literal>' ]
   [ [ WITH ] TAG ( <tag_name> = '<tag_value>' [ , ... ] ) ]
   [ BACKGROUND_INSTALL = { TRUE | FALSE } ]
Copy

Required parameters¶

name

Specifies the identifier for the application. Must be unique for your account.

In addition, the identifier must start with an alphabetic character and cannot contain spaces or special characters unless the entire identifier string is enclosed in double quotes (for example, "My object"). Identifiers enclosed in double quotes are also case-sensitive.

For more details, refer to Identifier requirements.

FROM APPLICATION PACKAGE package_name

Specifies the name of the application package used to create the application. To use this clause to create an application from an application package without specifying a stage or a version/patch, the application package must have a default release directive defined.

This clause can only be used to create an application in the same account as the application package. This clause cannot be used to create an application in development mode.

FROM LISTING listing_name

Specifies the name of listing containing the application package used to create the application.

USING path_to_version_directory

Specifies the path to the stage containing the application files for the application.

USING version [ PATCH patch_num ]

Specifies the version, and optionally the patch, defined in the application package used to create the application.

Optional parameters¶

COMMENT = 'string_literal'

Specifies a comment for the application.

Default: No value

DEBUG_MODE = { TRUE | FALSE }

Enables or disables debug mode for the application object being created. Debug mode allows a provider to see the contents of the application object.

  • TRUE enables debug mode for the installed application.

  • FAlSE disables debug mode for the installed application.

Note

You can only set DEBUG_MODE if the application meets the following requirements:

  • The application is in the same account as the application package.

  • The application is being created from a specific version or from files on a named stage.

TAG ( tag_name = 'tag_value' [ , tag_name = 'tag_value' , ... ] )

Specifies the tag name and the tag string value.

The tag value is always a string, and the maximum number of characters for the tag value is 256.

For information about specifying tags in a statement, see Tag quotas for objects and columns.

BACKGROUND_INSTALL = { TRUE | FALSE }

Creates the application object from a listing in the background. If you specify this clause, the command returns you to the prompt immediately, and the installation process continues in the background. To monitor that status of the installation, use the DESCRIBE APPLICATION command.

Note

When using this clause, the application object is created even if the command fails. In this situation, use the DROP APPLICATION command to delete the object before running the CREATE APPLICATION command again.

This clause is primarily used by Snowsight to install a Snowflake Native App in the background. Background installation allows the consumer to navigate away from the listing in Snowsight during installation. A provider might use this clause when testing the installation of a Snowflake Native App from a listing before publishing the listing.

Access control requirements¶

A role used to execute this SQL command must have the following privileges at a minimum:

Privilege

Object

Notes

CREATE APPLICATION

Account

DEVELOP

Application package

INSTALL

Application package

IMPORT SHARE

CREATE APPLICATION

Account

These privileges are required to create an application object in an account different than the account that contains the application package.

Usage notes¶

  • To create an application directly from an application package, you must specify a default release directive in the application package.

  • The application object differs from a database in the following ways:

    • An application may not be transient.

    • The role with the OWNERSHIP privilege on the application:

      • Can drop the database or modify the COMMENT property as well as any properties that are specific to the application.

      • Cannot see or modify the contents of the application except via the privileges granted the application roles. Also, this role cannot create a database-level object, such as a schema or a database role.

  • Regarding metadata:

    Attention

    Customers should ensure that no personal data (other than for a User object), sensitive data, export-controlled data, or other regulated data is entered as metadata when using the Snowflake service. For more information, see Metadata fields in Snowflake.

  • CREATE OR REPLACE <object> statements are atomic. That is, when an object is replaced, the old object is deleted and the new object is created in a single transaction.

Examples¶

CREATE APPLICATION hello_snowflake_app
  FROM APPLICATION PACKAGE hello_snowflake_package
  USING VERSION v1;
Copy
+---------------------------------------------------------+
| status                                                  |
|---------------------------------------------------------|
| Application 'hello_snowflake_app' created successfully. |
+---------------------------------------------------------+
CREATE APPLICATION hello_snowflake_app
  FROM APPLICATION PACKAGE hello_snowflake_package
  USING '@hello_snowflake_code.core.hello_snowflake_stage';
Copy
+---------------------------------------------------------+
| status                                                  |
|---------------------------------------------------------|
| Application 'hello_snowflake_app' created successfully. |
+---------------------------------------------------------+