CREATE APPLICATION PACKAGE

Creates a new application package that contains the data content and application logic of Snowflake Native App. An application package contains the following information about an app:

  • 应用程序的版本和补丁号。
  • 应用程序可用的数据内容。
  • 应用程序的安装脚本。
  • 应用程序的清单文件。
See also:

ALTER APPLICATION PACKAGE, DROP APPLICATION PACKAGE, SHOW APPLICATION PACKAGES

语法

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 } ]
  [ LISTING_AUTO_REFRESH = { TRUE | FALSE } ]
  [ MULTIPLE_INSTANCES = TRUE ]
  [ ENABLE_RELEASE_CHANNELS = TRUE ]

必填参数

name

指定应用程序包的标识符;对于您的账户必须是唯一的。

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.

可选参数

DATA_RETENTION_TIME_IN_DAYS = integer

指定可以对应用程序包执行 Time Travel 操作(CLONE 和 UNDROP)的天数,并指定在数据库中创建的所有架构的默认 Time Travel 保留时间。

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.

值:

  • Standard Edition: 0 or 1
  • Enterprise Edition:
    • 0 to 90 for permanent databases

默认:

  • 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

对象参数,指定 Snowflake 为防止应用程序包内的表上的流过时,而可以将这些表的数据保留期延长的最大天数。

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'

指定应用程序包的注释。

默认:无值

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.

DISTRIBUTION = { INTERNAL | EXTERNAL }

指定提供商在使用应用程序包作为列表的数据产品时,可以创建的列表类型。

  • INTERNAL indicates that a provider can only create a private listing within the same organization where the application package was created. The automated security scan is not performed when the DISTRIBUTION property is set to INTERNAL.
  • EXTERNAL indicates that a provider can create listings outside the same organization where the application package was created.

See Run the automated security scan for information on setting the DISTRIBUTION property and the automated security scan.

Note

Setting the DISTRIBUTION parameter 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:

  • 不能为版本或补丁设置发布指令。
  • 不能发布应用程序包的列表。
LISTING_AUTO_REFRESH = { TRUE | FALSE}

When set to TRUE, initiates replication to all remote regions when there is a change to the release directive of the application package. When a release directive changes, the application package does not wait for the Cross-Cloud Auto-Fulfillment schedule.

MULTIPLE_INSTANCES = TRUE

允许使用者从应用程序包中安装一个应用程序的多个实例。无法为试用版或付费列表中所含的应用程序包设置此属性。

当允许多个实例时,使用者最多可以在其账户中安装一个应用程序的 10 个实例。

Caution

After this property is set to TRUE, it cannot be set to FALSE or unset later.

ENABLE_RELEASE_CHANNELS = TRUE | FALSE

Enables release channels for the application package.

Caution

After setting this property to TRUE, it cannot be set to FALSE or unset later.

访问控制要求

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

权限对象备注
CREATE APPLICATION PACKAGE账户只有 ACCOUNTADMIN 角色默认具有此权限。可以根据需要将此权限授予其他角色。

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.

使用说明

  • 要创建应用程序包,调用方必须对账户具有 CREATE APPLICATION PACKAGE 权限。

  • 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.

  • 关于元数据:

    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.

示例

CREATE APPLICATION PACKAGE hello_snowflake_package;
+-----------------------------------------------------------------------+
| status                                                                |
%-----------------------------------------------------------------------%
| Application Package 'hello_snowflake_package' created successfully.   |
+-----------------------------------------------------------------------+