Declarative Native App command reference

以下命令包括支持创建和发布应用程序包的新参数:

CREATE APPLICATION PACKAGE

The CREATE APPLICATION PACKAGE command supports a new optional parameter, TYPE = DATA, which specifies that the app will be a Declarative Native App.

语法

CREATE APPLICATION PACKAGE [ IF NOT EXISTS ] <name> TYPE = DATA

新的可选参数:

TYPE = [ DATA | NATIVE ]

指定要创建的应用程序包类型:

  • DATA: indicates that the application package will contain a Declarative Native App.
  • NATIVE: indicates that the application package will contain a Snowflake Native App. This is the default value.

指定应用程序包类型后,不能稍后使用 ALTER APPLICATION PACKAGE 更改类型。

When TYPE = DATA is specified, the other parameters in this command, such as DATA_RETENTION_TIME_IN_DAYS and COMMENT, are not supported.

This parameter requires a role with the CREATE APPLICATION PACKAGE and CREATE DATABASE privileges.

应用程序包的创建者会自动获得该应用程序包的 OWNERSHIP 权限。

ALTER APPLICATION PACKAGE

The ALTER APPLICATION PACKAGE command supports the following new optional parameters to support creating and publishing Declarative Native Apps. These new parameters are not supported for Snowflake Native Apps.

语法

ALTER APPLICATION PACKAGE <name>
[ ADD LIVE VERSION
| ADD VERSION FROM @STAGE/path
| BUILD
| COMMIT
| RELEASE [LIVE VERSION]
| ABORT LIVE VERSION ]
[COMMENT = 'string_literal']

新的可选参数

ADD LIVE VERSION

创建可编辑的应用程序包的实时版本。此实时版本用于添加或更新文件,例如清单文件和笔记本文件。

ADD VERSION FROM @<STAGE>/<path>

Creates a live version of the application package based on files from a stage. This method is useful if you have a set of files that you want to include in the application package, and you want to add them all at once.

Note

如果在创建实时版本后对文件进行迭代,则需要对暂存区上的文件进行相同的更改,以保持未来版本的一致性。

BUILD

构建应用程序,但不提交。使用此命令验证清单文件并继续处理应用程序包。

COMMIT

构建应用程序,提交以供发布,但不立即发布。

提交过程通过添加内部版本号来准备应用程序包以供发布,并将应用程序包设为不可变。

RELEASE

Releases a committed version of the app to the Snowflake Marketplace.

RELEASE LIVE VERSION

Builds the app, commits it for publishing, and releases it to the Snowflake Marketplace.

相当于按顺序运行 BUILD、COMMIT 和 RELEASE 命令。

ABORT LIVE VERSION

移除应用程序包的 LIVE 版本。将应用程序包恢复到上次提交的版本。

现有参数

These parameters are supported for both Declarative Native Apps and Snowflake Native Apps.

<name>

指定应用程序包的标识符。

如果标识符包含空格、特殊字符或大小写混合字符,则整个字符串必须放在双引号内。放在双引号内的标识符也区分大小写。

COMMENT = 'string_literal'

可选:为应用程序版本添加注释或覆盖现有注释。此注释显示在 SHOW APPLICATION PACKAGES 中。

访问控制要求

此命令需要具有应用程序包 OWNERSHIP 权限的角色。

示例

  • 创建新的应用程序包:

    CREATE APPLICATION PACKAGE market_data_app TYPE = DATA;
  • 创建可编辑的应用程序包的实时版本:

    ALTER APPLICATION PACKAGE market_data_app
      ADD LIVE VERSION
      COMMENT = 'Market views for Northern region';
  • 从现有的暂存应用程序包创建应用程序包的新版本:

    ALTER APPLICATION PACKAGE market_data_app
      ADD VERSION FROM @my_stage/market_data_app_v1;
  • 构建应用程序包,但不提交:

    ALTER APPLICATION PACKAGE market_data_app BUILD;
  • 构建并提交应用程序包以供发布,但不立即发布:

    ALTER APPLICATION PACKAGE market_data_app
      COMMIT
      COMMENT = 'Market views for North and East regions';
  • Release the application package to the Snowflake Marketplace:

    ALTER APPLICATION PACKAGE market_data_app RELEASE;
  • Build, commit, and release the live version of the application package to the Snowflake Marketplace:

    ALTER APPLICATION PACKAGE market_data_app RELEASE LIVE VERSION
      COMMENT = 'Market views for North, East, and West regions';
  • 添加应用程序端的实时版本并对其进行编辑后,停止编辑并恢复到上次提交的版本:

    ALTER APPLICATION PACKAGE market_data_app ABORT LIVE VERSION

GRANT IMPORTED PRIVILEGES ON APPLICATION

The GRANT IMPORTED PRIVILEGES command supports a new optional parameter, ON APPLICATION <name>.

This command allows consumers to grant access to all of the data and views in a Declarative Native App to other members of their organization.

This command can be used on any Declarative Native App, and does not require app roles to be defined for the application package.

访问控制要求

此命令需要具有已安装应用程序 OWNER 权限的角色。

语法

GRANT IMPORTED PRIVILEGES ON APPLICATION <name> TO ROLE <role_name>;

示例

GRANT IMPORTED PRIVILEGES ON APPLICATION market_data_app TO ROLE marketing_team_east;