CREATE APPLICATION¶
根据应用程序包或列表创建 Snowflake Native App。提供商使用此命令在其开发账户中安装应用程序。
When this command runs, it runs the setup script to create the app.
语法¶
CREATE APPLICATION <name> FROM APPLICATION PACKAGE <package_name>
[ USING RELEASE CHANNEL { QA | ALPHA | DEFAULT } ]
[ COMMENT = '<string_literal>' ]
[ [ WITH ] TAG ( <tag_name> = '<tag_value>' [ , ... ] ) ]
[ AUTHORIZE_TELEMETRY_EVENT_SHARING = { TRUE | FALSE } ]
[ WITH FEATURE POLICY = <policy_name> ]
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>' [, ...] ) ]
[ AUTHORIZE_TELEMETRY_EVENT_SHARING = { TRUE | FALSE } ]
[ WITH FEATURE POLICY = <policy_name> ]
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>' [ , ... ] ) ]
[ AUTHORIZE_TELEMETRY_EVENT_SHARING = { TRUE | FALSE } ]
[ WITH FEATURE POLICY = <policy_name> ]
CREATE APPLICATION <name> FROM LISTING <listing_name>
[ USING RELEASE CHANNEL { QA | ALPHA | DEFAULT } ]
[ COMMENT = '<string_literal>' ]
[ [ WITH ] TAG ( <tag_name> = '<tag_value>' [ , ... ] ) ]
[ BACKGROUND_INSTALL = { TRUE | FALSE } ]
[ AUTHORIZE_TELEMETRY_EVENT_SHARING = { TRUE | FALSE } ]
[ WITH FEATURE POLICY = <policy_name> ]
必填参数¶
nameSpecifies the identifier for the app. Must be unique for your account.
此外,标识符必须以字母字符开头,且不能包含空格或特殊字符,除非整个标识符字符串放在双引号内(例如,
"My object")。放在双引号内的标识符也区分大小写。有关更多详细信息,请参阅 标识符要求。
FROM APPLICATION PACKAGE package_nameSpecifies the name of the application package used to create the app. To use this clause to create an app 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 app in the same account as the application package. This clause cannot be used to create an app in development mode.
FROM LISTING listing_nameSpecifies the name of the listing that contains the application package used to create the app.
USING RELEASE CHANNEL QA | ALPHA | DEFAULT指定用于创建应用程序的应用程序包或列表中定义的发布通道。如果您未指定此子句,则使用默认的发布通道。
QA指定质量保证发布通道。ALPHA指定 Alpha 发布通道。DEFAULT指定默认发布通道。
This clause can be used only when creating an app from an application package that has a release directive defined or when creating an app from a listing.
USING path_to_version_directorySpecifies the path to the stage that contains the files required by the app.
USING version [ PATCH patch_num ]Specifies the version, and optionally the patch, defined in the application package used to create the app.
可选参数¶
COMMENT = 'string_literal'Specifies a comment for the app.
默认:无值
DEBUG_MODE = { TRUE | FALSE }Enables or disables debug mode for the app being created. Debug mode allows a provider to see the contents of the app.
TRUEenables debug mode for the installed app.FAlSEdisables debug mode for the installed app.
备注
You can only enable debug mode under the following conditions:
The app is in the same account as the application package.
The app is being created based on a specific version or from files on a named stage.
TAG ( tag_name = 'tag_value' [ , tag_name = 'tag_value' , ... ] )指定 标签 名称和标签字符串值。
标签值始终为字符串,标签值的最大字符数为 256。
有关在语句中指定标签的信息,请参阅 Tag quotas。
BACKGROUND_INSTALL = { TRUE | FALSE }Creates the app 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.
备注
When this clause is used, the app 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.
此子句主要由 Snowsight 在后台安装 Snowflake Native App 时使用。后台安装允许使用者在安装过程中离开 Snowsight 中的列表。列表发布之前,提供商在测试 Snowflake Native App 安装时可能会使用此子句。
AUTHORIZE_TELEMETRY_EVENT_SHARING = { TRUE | FALSE }在应用程序中启用 日志记录和事件共享。
WITH FEATURE POLICY = policy_name使用指定的功能策略创建应用程序。如果应用程序尝试创建功能策略禁止的对象(例如数据库),则该命令会失败。
访问控制要求¶
权限 |
对象 |
备注 |
|---|---|---|
CREATE APPLICATION |
账户 |
|
DEVELOP |
应用程序包 |
|
INSTALL |
应用程序包 |
|
IMPORT SHARE CREATE APPLICATION |
账户 |
在与包含应用程序包的账户不同的账户中创建应用程序时,需要这些权限。 |
APPLY FEATURE POLICY APPLY 或 OWNERSHIP |
账户 功能策略 |
使用 WITH FEATURE POLICY 子句创建应用程序时,需要这些权限才能应用功能策略。 |
使用说明¶
To create an app directly from an application package, you must specify a default release directive in the application package.
The app differs from a database in the following ways:
An app may not be transient.
The role with the OWNERSHIP privilege on the app has the following abilities and limitations:
Can drop the database or modify the COMMENT property and any properties that are specific to the app.
Cannot see or modify the contents of the app except via the privileges granted the application roles.
无法创建数据库级对象,例如架构或数据库角色。
关于元数据:
注意
客户应确保在使用 Snowflake 服务时,不会将个人数据(用户对象除外)、敏感数据、出口管制数据或其他受监管数据作为元数据输入。有关更多信息,请参阅 Snowflake 中的元数据字段。
CREATE OR REPLACE <object> 语句是原子的。也就是说,当对象被替换时,旧对象将被删除,新对象将在单个事务中创建。
示例¶
CREATE APPLICATION hello_snowflake_app
FROM APPLICATION PACKAGE hello_snowflake_package
USING VERSION v1;
+---------------------------------------------------------+
| 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';
+---------------------------------------------------------+
| status |
|---------------------------------------------------------|
| Application 'hello_snowflake_app' created successfully. |
+---------------------------------------------------------+