Snowflake Native App manifest file reference

本主题介绍了 Snowflake Native App 清单文件的结构和字段。

manifest_version 字段

指定清单文件格式的版本。

此字段为必填字段。

manifest_version: 1

清单文件的这一版本支持 Snowflake Native Apps 的当前功能和旧版功能。

示例:manifest_version: 1

manifest_version: 2

清单文件的这一版本支持其他功能,包括自动授予权限。

小心

在使用清单文件的版本 2 之前,请考虑 关于清单文件 中描述的安全影响。

示例:manifest_version: 2

manifest_version 示例

manifest_version: 2
Copy

version 字段

定义一个块,其中包含与应用程序版本相关的字段。有关版本和补丁的更多信息,请参阅 Update an app (Legacy)

备注

使用 CREATE APPLICATION PACKAGEALTER APPLICATION PACKAGE 命令定义的版本和补丁优先于清单文件中定义的版本和补丁。

此字段是可选字段。

name

Specifies the name of the version. The version name can only contain alphanumeric characters, underscores (_), hyphens (-), dollar signs ($), periods (.), and spaces.

此字段是可选字段。

示例:name: v1

patch

指定默认补丁编号。

此字段是可选字段。

示例:patch: 1

label

指定显示给使用者的版本的名称。

此字段是可选字段。

示例:label: "Initial Release"

comment

指定版本的注释。此注释在 Snowsight 中可见,或在提供商运行 SHOW VERSIONS IN APPLICATION PACKAGE 命令时可见。

此字段是可选字段。

示例:comment: "This is the initial release of the app."

version: example

version:
  name: v1
  patch: 1
  label: "Initial Release"
  comment: "This is the initial release of the app."
Copy

artifacts: field

定义一个块,用于指定应用程序使用的资源。

此字段为必填字段。

setup_script:

Specifies the path and filename of the setup script that is run when the Snowflake Native App is installed or upgraded. If you do not specify a value, the app uses the default value is setup.sql in the same directory as the manifest file. The setup script name and path can only contain alphanumeric characters, underscores (_), hyphens (-), periods (.), backslashes (), and forward slashes (/).

示例:setup_script: scripts/setup.sh

readme:

指定 Markdown 自述文件的路径,该文件提供应用程序及其功能的概述。

对于 Streamlit 应用程序,如果未为 default_streamlit 属性指定值,则在查看已安装的 Snowflake Native App 时,将向使用者显示此文件的内容。

此文件的位置是相对于清单文件的位置指定的。

此字段是可选字段,但 Snowflake 建议您在应用程序中包含自述文件。

示例:readme: docs/README.md

default_streamlit_app:

如果 Snowflake Native App 包含 Streamlit 应用程序,此属性指定使用者可用的默认 Streamlit 应用程序的架构和名称。

如果应用程序包含 Streamlit 应用程序,则此字段为必填字段。

extension_code:

Enables or disables the use of extension code languages, including Java, Python, and Scala.

示例:extension_code: true

container_services:

指定带容器的应用程序使用的容器镜像的位置。有关更多信息,请参阅 指定包含容器的应用程序使用的容器映像

对于带容器的应用程序,此字段为必填字段。

uses_gpu:

表示带容器的应用程序使用 GPU。

对于带容器的应用程序,此字段为必填字段。

示例:uses_gpu: true

images:

指定带容器的应用程序使用的每个容器镜像的路径。

对于带容器的应用程序,此字段为必填字段。

示例:

images:
- /spcs_app/napp/img_repo/eap_frontend
- /spcs_app/napp/img_repo/eap_backend
- /spcs_app/napp/img_repo/eap_router
Copy

artifacts 示例

artifacts:
  setup_script: scripts/setup.sql
  readme: docs/README.md
  default_streamlit_app: apps/main.py
  extension_code: true
  container_services:
      uses_gpu: true
      images:
        - /spcs_app/napp/img_repo/eap_frontend
        - /spcs_app/napp/img_repo/eap_backend
Copy

configuration 字段

指定包含应用程序的配置属性的块。

此字段是可选字段。

log_level:

指定要用于应用程序 Snowflake Native App 的日志记录级别。

If you do not set a value for this property, the default log data is not captured.

有关支持的值的信息,请参阅 为日志、指标和跟踪设置级别

trace_level:

指定要用于应用程序的跟踪事件级别。在提供商启用跟踪时,应用程序会自动获取所有查询和存储过程调用的开始时间和结束时间。

小心

如果将 trace_level 属性设置为 OFF 以外的值,则发布应用程序可能会向使用者账户中可查看事件表的任何用户公开对隐藏存储过程的调用。

If you do not set a value for this property, trace events are not captured.

有关 trace_level 属性支持的值,请参阅 为日志、指标和跟踪设置级别

metric_level:

指定要用于应用程序的指标级别。当提供商启用指标时,应用程序会自动向事件表发出自动检测的资源指标数据点。

有关更多信息,请参阅 为应用程序设置日志和跟踪级别

有关 metric_level 属性支持的值,请参阅 为日志、指标和跟踪设置级别

grant_callback:

指定带容器的应用程序的回调函数的架构和名称。回调函数是一个存储过程,可以创建计算池、服务以及执行应用程序所需的其他设置任务。

对于带容器的应用程序,此字段为必填字段。

有关更多信息,请参阅 使用 grant_callback 属性创建服务

示例:grant_callback: my_schema.my_grant_callback

configuration 示例

configuration:
  log_level: INFO
  trace_level: OFF
  metric_level: BASIC
  grant_callback: my_schema.my_grant_callback
Copy

privileges: field

定义一个块,其中包含应用程序在使用者账户中请求的权限。

This field is required if the app requests privileges in the consumer account.

<privilege_name>:

指定应用程序在使用者账户中请求的权限的名称。

如果指定了 privileges 属性,则此字段为必填字段。

description:

提供所请求权限的描述。当使用 Python Permission SDK 在 Snowsight 中显示权限时,或者当运行 SHOW PRIVILEGES 命令时,将向使用者显示 description 中指定的文本。

作为提供商,您应该提供尽可能多的信息,以说明为什么 Snowflake Native App 需要此权限,以及此权限是必需项还是可选项。

如果指定了 privileges 字段,则此字段为必填字段。

privileges: example

privileges:
- CREATE TABLE:
  description: 'Required to create tables in the consumer account.'
- CREATE COMPUTE POOL:
  description: 'Required to allow the app to create a compute pool in the consumer account.'
- BIND SERVICE ENDPOINT:
  description: 'Required to allow endpoints to be externally accessible.'
Copy

references: field

定义一个块,其中包含应用程序在使用者账户中请求的引用。使用者必须将这些引用绑定到其账户中的对象。

如果应用程序在使用者账户中请求引用,则此字段为必填字段。

- <reference_name>:

指定应用程序在使用者账户中请求的引用的名称。

如果指定了 references 属性,则此字段为必填字段。

label:

指定向使用者显示的引用的标签。

如果指定了 references 属性,则此字段为必填字段。

示例:label: "Orders table"

description:

提供所请求引用的描述。当使用 Python Permission SDK 在 Snowsight 中显示引用时,或者当运行 SHOW REFERENCES 命令时,将向使用者显示 description 中指定的文本。

如果指定了 references 属性,则此字段为必填字段。

privileges:

指定应用程序对使用者账户中引用绑定到的对象所需的权限列表。

如果指定了 references 属性,则此字段为必填字段。

示例:

privileges:
  - SELECT
  - INSERT
Copy

object_type

指定与引用关联的对象的类型,例如架构和表,或者 API 集成。

如果指定了 references 字段,则此字段为必填字段。

示例:object_type: TABLE

有关更多信息,请参阅 引用中可以包含的对象类型和权限

multi_valued:

允许多个对象与引用关联。使用此属性将多个使用者对象绑定到同一引用。当指定此属性时,将对具有单个值引用的对象执行相同的操作。该属性还可以用于具有多值引用的对象。

此字段是可选字段。默认值为 false

有关更多信息,请参阅 向使用者请求引用和对象级权限

示例:multi_valued: true

register_callback

指定使用者将引用绑定到其账户中的对象时运行的回调函数的架构和名称。

如果指定了 references 属性,则此字段为必填字段。

示例:register_callback: my_schema.my_register_callback

configuration_callback

指定回调函数的名称,该函数将为绑定到此引用的对象提供所需的配置。

如果 object_typeEXTERNAL ACCESS INTEGRATIONSECRET,则此属性为必需。此属性不适用于其他类型的对象。

required_at_setup

表示必须在安装应用程序时绑定引用。

示例:required_at_setup: true

references 示例

references:
- ORDERS_TABLE:
    label: "Orders table"
    description: "Orders table in TPC-H samples"
    privileges:
      - SELECT
    object_type: VIEW
    multi_valued: false
    register_callback: v1.register_single_callback

- EXTERNAL_ENDPOINT_EAI:
    label: "Allows egress to an external API"
    description: "EAI for Egress from NA+SPCS"
    privileges: [USAGE]
    object_type: EXTERNAL_ACCESS_INTEGRATION
    register_callback: v1.register_single_callback
    configuration_callback: v1.get_configuration
    required_at_setup: true
Copy

restricted_callers_rights: field

指定与受限制的调用方权限相关的配置属性。

如果应用程序创建了以受限制的调用方权限运行的存储过程或 Snowpark Container Services 服务,则此字段为必填字段。

有关更多信息,请参阅 在应用程序中使用所有者权限和受限制的调用方权限

enabled:

指定是否允许应用程序创建调用方权限受限的可执行文件。

如果应用程序创建了以受限制的调用方权限运行的存储过程或 Snowpark Container Services 服务,则提供商必须将此属性设置为 true

description:

说明应用程序需要创建调用方权限受限的可执行文件的原因。

restricted_callers_rights: example

restricted_callers_rights:
  enabled: true
  description: "Required to create stored procedures that run with restricted caller's rights."
Copy

restricted_features: field

Specifies configuration properties related to features that require consumer approval to enable.

external_data

If present, specifies that the app shares external tables or Iceberg tables. For more information, see 请求访问外部表和 Apache Iceberg™ 表.

restricted_features: example

restricted_features:
  - external_data:
     description: “The reason for enabling an external or Iceberg table.”
Copy
语言: 中文