Activating query results¶
Overview of activation¶
A collaborator can send template results outside the clean room in a process called activation. The template must support activation, and each data provider must approve activation at the column level in their data offering specification.
Activation is implemented using a dedicated activation template. An activation template doesn’t return results to the query runner, but instead writes them to a results table in the target user’s account.
Note
Activating results to another Snowflake account requires Snowflake Enterprise Edition or higher.
Implementing activation¶
Here are the steps to implement activation:
You must use a role that has the REGISTER DATA OFFERING privilege to join any collaboration where you are an analysis runner and the collaboration specification includes an
activation_destinationsfield.Ensure that all specifications are properly configured:
The data offering specification for the table with the activated column must set
activation_allowed: TRUEfor that column:The collaboration specification must provide
activation_destinationsvalues for the analysis runner. The data offering specification further limits activation to designated analysis runners and templates.The analysis specification must include an
activationsection withsnowflake_collaboratorandsegment_namevalues, and call an activation template. You can’t activate results by running a standard analysis template.You must use an activation template. This template saves results to an internal table. All projected columns from this template are activated.
Any column in the template with the
activation_policyfilter applied must haveactivation_allowed: TRUEin the data offering specification.Note
If a template doesn’t apply the
activation_policyfilter to a column, the column can be activated whether or notactivation_allowed: TRUEis set for that column in the data offering spec.The following example shows a template with the activation policy applied to two columns supplied by the analysis runner:
The analysis runner calls RUN to run the analysis and activate the results.
If activating to yourself, results are available immediately in the caller’s account.
If activating to another collaborator:
The collaborator calls VIEW_ACTIVATIONS until it returns a status of SHARED.
Activating to another account can take considerable time for large result sets, as the data must be shared to the collaborator’s account. Cross-cloud collaborators will also experience additional delays due to replication frequency settings.
When the status of the activation is SHARED, the collaborator calls PROCESS_ACTIVATION to send the results to their account.
The response to PROCESS_ACTIVATION includes the table and segment names. This sets the activation status to PROCESSED.
The analysis runner can read results as described in the next section.
Reading the activation results¶
When activation is complete, as described in the previous section, results are stored in the
collaboration_name.activation.segment_records table in your account.
The table has the following schema:
Column |
Description |
|---|---|
BATCH_ID |
UID for the batch job that was processed. |
SEGMENT_NAME |
Name for the activation payload. |
TEMPLATE_ID |
ID of the template used for activation. |
SHARED_BY |
Name of the collaborator who activated the data. |
UPDATED_ON |
Timestamp of when the batch was processed successfully. |
RECORDS |
Payload of activated IDs and attributes from the activation template. |
Note
If a collaborator leaves the clean room, they lose access to the application, including the table that contains the activated results.
To retrieve the activation results, run the following SQL command, optionally filtering by segment name: