CREATE APPLICATION PACKAGE¶

Creates a new application package that contains the data content and application logic of an application using the Native Apps Framework. An application package is a database with added features that specify the following:

  • The version of an application.

  • The data content that is available to the application.

See also:

ALTER APPLICATION PACKAGE, DROP APPLICATION PACKAGE, SHOW APPLICATION PACKAGES

Syntax¶

CREATE APPLICATION PACKAGE [ IF NOT EXISTS ] <name>
  [ DATA_RETENTION_TIME_IN_DAYS = <integer> ]
  [ MAX_DATA_EXTENSION_TIME_IN_DAYS = <integer> ]
  [ DEFAULT_DDL_COLLATION = '<collation_specification>' ]
  [ COMMENT = '<string_literal>' ]
  [ [ WITH ] TAG ( <tag_name> = '<tag_value>' [ , ... ] ) ]
  [ DISTRIBUTION = { INTERNAL | EXTERNAL } ]
Copy

Required parameters¶

name

Specifies the identifier for the application package; 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 (e.g. "My object"). Identifiers enclosed in double quotes are also case-sensitive.

For more details, see Identifier requirements.

Optional parameters¶

DATA_RETENTION_TIME_IN_DAYS = integer

Specifies the number of days for which Time Travel actions (CLONE and UNDROP) can be performed on the application package, as well as specifying the default Time Travel retention time for all schemas created in the database.

For more details, see Understanding & using Time Travel.

For a detailed description of this object-level parameter, as well as more information about object parameters, see Parameters.

Values:

  • Standard Edition: 0 or 1

  • Enterprise Edition:

    • 0 to 90 for permanent databases

Default:

  • Standard Edition: 1

  • Enterprise Edition (or higher): 1 (unless a different default value was specified at the account level)

Note

A value of 0 disables Time Travel for the database.

MAX_DATA_EXTENSION_TIME_IN_DAYS = integer

Object parameter that specifies the maximum number of days for which Snowflake can extend the data retention period for tables in the application package to prevent streams on the tables from becoming stale.

For a detailed description of this parameter, see MAX_DATA_EXTENSION_TIME_IN_DAYS.

DEFAULT_DDL_COLLATION = 'collation_specification'

Specifies a default collation specification for all schemas and tables added to the application package. The default can be overridden at the schema and individual table level.

For more details about the parameter, see DEFAULT_DDL_COLLATION.

COMMENT = 'string_literal'

Specifies a comment for the application package.

Default: No value

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.

DISTRIBUTION = { INTERNAL | EXTERNAL }

Specifies whether a consumer can create an application based on the application package in an external organization.

  • INTERNAL specifies that a consumer can create an application within the same organization where the application package was created.

  • EXTERNAL specifies that a consumer can create an application in a different organization.

    Note

    Setting the DISTRIBUTION paramater to EXTERNAL triggers an automated security review for each active version and patch defined in the application package.

    The following restrictions apply until the automated security review has a status of APPROVED:

    • You cannot set a release directive for a version or patch.

    • You cannot publish a listing for the application package.

Access control requirements¶

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

Privilege

Object

Notes

CREATE APPLICATION PACKAGE

Account

Only the ACCOUNTADMIN role has this privilege by default. The privilege can be granted to other roles as needed.

For instructions on creating a custom role with a specified set of privileges, see Creating custom roles.

For general information about roles and privilege grants for performing SQL actions on securable objects, see Overview of Access Control.

Usage notes¶

  • To create an application package, the caller must have the CREATE APPLICATION PACKAGE privilege on the account.

  • There are no restrictions on the types of objects that may reside in the application package or what roles (database or account level) that may own those objects.

  • 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 PACKAGE hello_snowflake_package;
Copy
+-----------------------------------------------------------------------+
| status                                                                |
|-----------------------------------------------------------------------|
| Application Package 'hello_snowflake_package' created successfully.   |
+-----------------------------------------------------------------------+