Declarative Native App manifest reference¶
提供商创建清单文件,作为 包 的一部分。
清单文件是基于文本的 `YAML<https://yaml.org/spec/>`_ 文件,文件名为:manifest.yml。它用于以声明方式与使用者共享数据,例如笔记本、表和视图。
清单文件还定义 应用程序角色,应用程序所有者可以使用这些角色来按角色向其组织团队中的团队共享应用程序数据和功能的子集。
有关开发应用程序包的信息,请参阅 Native Application Framework 的声明式共享中的应用程序包。
Declarative Native App manifest¶
The general format of a Declarative Native App manifest contains:
manifest_version: # Added automatically. Don't include.
application_content: # Optional, describes associated app logic
roles: # Optional, describes roles associated with shared_content
shared_content: # Required, describes associated data to be shared
字段¶
Declarative Native App manifests include the following fields:
manifest_version 字段¶
当您发布应用程序包的新版本时,此字段会自动添加到清单文件中。
创建要包含在应用程序包中的清单文件时,不要包含此字段。不支持手动编辑此字段。
manifest_version 顶级字段(整型,必填)指定清单文件的版本号。
有关版本控制的更多信息,请参阅 Native Application Framework 中声明式共享中的包版本。
application_content 字段¶
application_content 字段(列表,可选)定义应用程序以声明方式共享的捆绑内容。
此字段包括一个 notebooks 字段:
application_content.notebooks.{named notebook} 字段¶
每个命名笔记本都支持以下名称值对:
``main_file``(字符串,必填)交互式 Python 笔记本 (.ipynb) 文件的名称。
``comment``(字符串,可选):用于描述笔记本的注释。
``runtime_environment_version``(字符串,可选): 为笔记本执行上下文指定特定的 :ref:`运行时环境版本 <label-notebook_runtime_descriptions>`(如果适用于平台)。
roles(list, optional): A list of app roles that can grant access the notebook, for example,[sales,marketing]. When this field is empty ([]) or omitted, then only app owners and roles with granted IMPORTED PRIVILEGES receive access. The included roles must be defined in the top-level roles field.
application_context 示例¶
在此示例中,使用笔记本文件 NOTEBOOK1.ipynb 定义单个笔记本 salesbook,使用已知运行时 stable,并向被授予 sales 或 marketing 角色的人提供访问权限。
application_content:
notebooks:
- salesbook:
roles: [sales, marketing]
main_file: NOTEBOOK1.ipynb
comment: Notebook1: Sales and marketing notebook
runtime_environment_version: stable
roles:
- sales:
- marketing:
roles 字段¶
roles 顶级字段(列表,可选)定义 应用程序角色 列表。这些角色允许应用程序所有者向其组织提供应用程序中共享对象(如架构、表、视图和笔记本)的访问权限。
每个命名角色可以选择包含 comment,当应用程序所有者列出应用程序中的角色时,它会显示为描述。
这些角色在清单中由共享对象引用,位于命名的 notebook、schema、table 或 view 级别。对于位于 table 或 view 级别的对象,角色还必须在 schema 级别指定。
备注
All content in the manifest is accessible to the app owner, the ACCOUNTADMIN, and to roles that are granted IMPORTED PRIVILEGES to the app.
此清单文件中定义的对象名称用于运行时对象解析。如果提供商在未使用新版本更新清单文件的情况下更改对象名称,则使用者将无法访问该对象。
roles 示例¶
roles:
- sales:
- marketing:
application_content:
notebooks:
- salesbook:
roles: [sales, marketing]
main_file: NOTEBOOK1.ipynb
comment: Sales and marketing notebook
shared_content:
databases:
- sales:
schemas:
- orders:
roles: [sales, marketing]
tables:
- january_2025: # App owners/assignees only
- february_2025:
roles: [sales] # Accessible to sales only
- march_2025:
roles: [marketing] # Accessible to marketing only
- customer_info:
schemas:
- customer_contact:
roles: [customer_support]
views:
- customer_address:
roles: [customer_support] # Accessible to customer_support
- customer_details:
roles: [] # App owners/assignees only
有关角色的详细信息,请参阅 应用程序角色。
清单文件示例¶
The following code block is an example of a Declarative Native App manifest file:
manifest_version: 2
roles:
- VIEWER:
comment: "The VIEWER role provides access to only one view."
- ANALYST:
comment: "The ANALYST role provides access to both views and the table."
shared_content:
databases:
- SNAF_POPULATION_DB:
schemas:
- DATA_SCHEMA:
roles: [VIEWER, ANALYST]
tables:
- COUNTRY_POP_BY_YEAR:
roles: [ANALYST]
views:
- COUNTRY_POP_BY_YEAR_2000:
roles: [VIEWER, ANALYST]
application_content:
notebooks:
- intro_notebook:
roles: [VIEWER, ANALYST]
main_file: INTRO_NB.ipynb
- analyst_notebook:
roles: [ANALYST]
main_file: ANALYST_NB.ipynb