分析规范

指定分析运行者运行分析所需的所有信息,包括要使用的模板、要传递给模板的表以及模板使用的任何变量值。如果不使用自由格式 SQL 查询数据,任何想要运行分析的分析运行者都会使用此规范来定义模板和输入数据。

架构:

api_version: 2.0.0              # Required: Must be "2.0.0"
spec_type: analysis             # Required: Must be "analysis"
template: <template_id>         # Required: ID of the template to use
name: <analysis_name>           # Optional: Unique name (max 75 chars)
version: <version_string>       # Optional: Version identifier (max 20 chars)
description: <analysis_description>  # Optional: Description (max 1,000 chars)

template_configuration:         # Optional: Values used when running the template
  view_mappings:                # Optional: Mappings for shared data
    source_tables:              # Optional: Tables from data offerings. Populates the source_table array variable.
      - <source_table_name>     # One or more source table names from the TEMPLATE_VIEW_NAME column...
    <argument_name>: <view_name>  # Custom argument to template view name mapping
  local_view_mappings:          # Optional: Mappings for local data
    my_tables:                  # Optional: Tables from local data offerings. Populates the my_table array variable.
      - <my_table_name>         # One or more local table names...
    <argument_name>: <view_name>  # Custom argument to local template view name mapping
  arguments:                    # Optional: Template arguments as key-value pairs
    <argument_name>: <argument_value>  # One or more argument key-value pairs...
  activation:                   # Required for activation templates
    snowflake_collaborator: <alias>  # Collaborator alias for activation destination
    segment_name: <segment_name>     # Unique segment name for this activation
api_version

The version of the Collaboration API used. Must be 2.0.0.

spec_type

Specification type identifier. Must be analysis.

template: template_id

用于此分析的模板 ID。这必须是注册模板时获取的模板 ID,而不是模板名称。

name (Optional)

A unique, user-friendly name for this analysis. Must follow Snowflake identifier rules with a maximum of 75 characters and be unique within your Snowflake data clean room account.

version (Optional)

A version identifier for this analysis specification (maximum 20 characters). Must follow Snowflake identifier rules and be unique within your account for this analysis name. A good format to use is YYYY_MM_DD_V#. For example: 2025_10_22_V1.

description (Optional)

对此分析功能的简要描述(最多 1,000 个字符)。

template_configuration (Optional)

运行指定模板时使用的值。

view_mappings (Optional)

将实参名称映射到共享数据产品的模板视图名称。

source_tables (Optional)

List of view names to populate the source_table template variable. Use the table aliases specified in the data offering spec. You can get a list of available views by calling VIEW_DATA_OFFERINGS. Use the view names from the TEMPLATE_VIEW_NAME column. Format of each entry is collaborator_alias.data_offering_ID.dataset_alias.

argument_name: view_name

将实参名称自定义映射到模板视图名称(每个名称最多 255 个字符)。

local_view_mappings (Optional)

将实参名称映射到私有数据集的本地模板视图名称。

my_tables (Optional)

List of table names to populate the my_table template variable. This is available only to private datasets that you linked by calling LINK_LOCAL_DATA_OFFERING. Format of each entry is collaborator_alias.data_offering_ID.dataset_alias.

argument_name: view_name

将实参名称自定义映射到本地模板视图名称(每个名称最多 255 个字符)。

arguments (Optional)

以键值对形式呈现的模板实参。实参值可以是字符串、数字、布尔值、数组或对象,具体取决于模板要求。

activation (Required for activation templates)

运行激活模板时需要特定于激活的配置。

snowflake_collaborator

Collaborator alias for the activation destination (maximum 25 characters). Must match an alias defined in the collaborator_identifier_aliases section of the collaboration specification, and the collaborator must be listed in the activation_destinations section.

segment_name

Unique segment name for this activation (maximum 255 characters). Used to identify and track activation results. Must follow Snowflake identifier rules.