CREATE APPLICATION¶
Creates a Snowflake Native App based on an application package or listing. Providers use this command to install an app in their development account.
When this command runs, it runs the setup script to create the app.
语法
必填参数
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 (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指定用于创建应用程序的应用程序包的名称。要使用该子句从应用程序包创建应用程序而不指定暂存区或版本/补丁,应用程序包必须已定义默认发布指令。
此子句只能用于在与应用程序包相同的账户中创建应用程序。此子句不能用于在开发模式下创建应用程序。
FROM LISTING listing_name指定包含用于创建应用程序的应用程序包的列表的名称。
USING RELEASE CHANNEL { QA | ALPHA | DEFAULT }指定用于创建应用程序的应用程序包或列表中定义的发布通道。如果您未指定此子句,则使用默认的发布通道。
QAspecifies the quality assurance release channel.ALPHAspecifies the alpha release channel.DEFAULTspecifies the default release channel.
此子句只能在从定义了发布指令的应用程序包或从列表创建应用程序时使用。
USING path_to_version_directory指定包含应用程序所需文件的暂存区的路径。
USING version [ PATCH patch_num ]指定用于创建应用程序的应用程序包中定义的版本和补丁(可选)。
可选参数
COMMENT = 'string_literal'指定应用程序的注释。
默认:无值
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.
Note
您只能在以下条件下启用调试模式:
- 应用程序与应用程序包位于同一个账户中。
- 创建的应用程序基于特定版本,或从指定暂存区上的文件创建。
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.
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.
Note
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.
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.
AUTHORIZE_TELEMETRY_EVENT_SHARING = { TRUE | FALSE }Enables logging and event sharing in the app.
WITH FEATURE POLICY = policy_name使用指定的功能策略创建应用程序。如果应用程序尝试创建功能策略禁止的对象(例如数据库),则该命令会失败。
访问控制要求
A role used to execute this operation 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 | 在与包含应用程序包的账户不同的账户中创建应用程序时,需要这些权限。 |
APPLY FEATURE POLICY APPLY 或 OWNERSHIP | 账户 功能策略 | 使用 WITH FEATURE POLICY 子句创建应用程序时,需要这些权限才能应用功能策略。 |
使用说明
-
要从应用程序包直接创建应用程序,必须在应用程序包中指定默认发布指令。
-
应用程序在以下方面与数据库不同:
- 应用程序不能是瞬态的。
- 拥有应用程序 OWNERSHIP 权限的角色具有以下能力和限制:
- 可以删除数据库或修改 COMMENT 属性以及特定于应用程序的任何属性。
- 除非通过授予应用程序角色的权限,否则无法查看或修改应用程序的内容。
- 无法创建数据库级对象,例如架构或数据库角色。
-
关于元数据:
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.