application_content 字段
application_content 字段(列表,可选)定义应用程序以声明方式共享的捆绑内容。
此字段包括一个 notebooks 字段:
application_content.notebooks.{named notebook} 字段
每个命名笔记本都支持以下名称值对:
main_file (string, required) the path to the interactive Python notebook (.ipynb) file, relative to the root of the package version.
``comment``(字符串,可选):用于描述笔记本的注释。
``runtime_environment_version``(字符串,可选): 为笔记本执行上下文指定特定的 :ref:`运行时环境版本 <label-notebook_runtime_descriptions>`(如果适用于平台)。
roles (list, optional): A list of app roles that can grant access to 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.
备注
The main_file path is always relative to the root of the package
version (the snow://package/<DECL_SHARE_APP_PKG>/versions/<version> prefix).
For example, if the full path to the notebook file is
snow://package/<DECL_SHARE_APP_PKG>/versions/LIVE/NOTEBOOK.ipynb,
then specify main_file as just NOTEBOOK.ipynb.
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 字段
The roles top level field (list, optional) defines a list of app roles. These roles allow app owners to provide access to shared objects in an app --- such as schemas, tables, views, and notebooks --- to their organization.
每个命名角色可以选择包含 comment,当应用程序所有者列出应用程序中的角色时,它会显示为描述。
These roles are referenced in the manifest by shared objects, at the named notebook, schema, table, view, or semantic_view level. For objects at the table, view, or semantic_view level, roles must also be specified at the schema level.
备注
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
有关角色的详细信息,请参阅 应用程序角色。
shared_content 字段
The shared_content field (list, required) defines a list of databases declaratively shared by the app. Each database includes a list of named schemas. Each schema can include a list of named entities grouped by type.
This field includes a single databases field and an optional required_databases field:
shared_content.databases.{named database} 字段
每个命名数据库都支持以下名称值对:
shared_content.required_databases.{named database} field
The required_databases field (list, optional) defines a list of databases that
are dependencies of the shared databases. These databases are referenced by
views in the shared databases, but are not shared directly. For more information
about managing cross-database dependencies, see 依赖关系数据库:管理跨数据库引用.
When your application shares data from multiple databases, you must explicitly list all
additional databases that are referenced by objects in your shared content under
the required_databases field. This ensures that the application can be
deployed successfully in other regions where these databases may not exist by
default.
Including a database in the required_databases field is similar to
referencing a database using the REFERENCE_USAGE privilege in traditional
Secure Data Sharing. For information about the REFERENCE_USAGE privilege and how
dependent databases are shared in traditional data sharing, see
Share data from multiple databases.
schemas.{named schema} 字段
每个命名架构都支持以下名称值对:
tables (list, [OneOfRequired]): A list of named tables, which can include dynamic tables and Apache Iceberg tables.
``views``(列表,[OneOfRequired]):命名视图的列表。
semantic_views (list, [OneOfRequired]): A list of named semantic views.
functions (list, [OneOfRequired]): A list of named user-defined functions (UDFs).
procedures (list, [OneOfRequired]): A list of named stored procedures.
cortex_agents (list, [OneOfRequired]): A list of named Cortex Agents.
roles (list, optional): A list of app roles that the objects in the schema can use, 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.
[OneOfRequired]
(1,2,3,4,5,6,7,8,9,10,11,12)
at least one of tables, views, semantic_views, functions, procedures, or cortex_agents is required.
重要
You must enforce schema separation between data objects (objects shared by reference: tables, views, and semantic_views) and logic objects (objects shared by copy: functions, procedures, and :cortex_agents). You can't mix data and logic objects in the same schema.
tables.{named table} 字段
Each named standard table, dynamic table, and Apache Iceberg table (List, required [OneOfRequired] ) supports the following name value pair:
备注
Shared dynamic tables and Apache Iceberg tables replicated to remote regions are read-only and do not refresh automatically. Data freshness depends on the replication frequency from the source, and underlying source objects do not need to be replicated. For details, see 复制的注意事项.
备注
To allow consumers to create streams on this shared object (for change data capture or incremental loading), you must enable CHANGE_TRACKING = TRUE on the source table in your provider account using standard SQL commands (for example, ALTER TABLE ... SET CHANGE_TRACKING = TRUE). This setting can't be changed by the consumer on the shared object; it must be set on the source.
views.{named view} 字段
每个命名视图(列表,必填 [OneOfRequired]):支持以下名称值对:
备注
To allow consumers to create streams on this shared object (for change data capture or incremental loading), you must enable CHANGE_TRACKING = TRUE on the source table in your provider account using standard SQL commands (for example, ALTER TABLE ... SET CHANGE_TRACKING = TRUE). This setting can't be changed by the consumer on the shared object; it must be set on the source.
semantic_views.{named semantic view} field
Each named semantic view (List, required [OneOfRequired] ): supports the following name value pair:
roles (list, optional): A list of app roles that can access the semantic view; for example, [sales]. Note that, when sharing a semantic view, its referenced tables or views must be shared as well. 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 and included in the {named schema}.roles field.
functions.{named function} field
Each named function (List, required [OneOfRequired] ): supports the following name value pair:
procedures.{named procedure} field
Each named stored procedure (List, required [OneOfRequired] ): supports the following name value pair:
cortex_agents.{named cortex agent} field
Each named Cortex Agent (List, required [OneOfRequired] ): supports the following name value pair:
shared_content 示例
In this example, two databases are exposed: sales and customer_info.
Within these databases the orders.[january_2025|february_2025] tables are exposed
as well as the customer_contact.customer_address view.
Two required databases are also exposed: sales_projections and customer_analytics.
These databases can be referenced by views in the shared databases, but are not shared directly.
roles:
- sales:
- marketing:
shared_content:
required_databases:
sales_projections
customer_analytics
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