Module 19 · Lesson 8 of 9Detailed study · about 45 min

Snowflake Data Clean Rooms: run a governed customer overlap

Configure a Collaboration Data Clean Room and use a built-in template to count shared customers without returning customer lists.

Before you beginReview the provider and consumer model

Count overlapping customers without sending customer lists

Maple Market wants to estimate how many of its customers also appear in Beacon Media’s audience. A direct share would let the partner query the objects you expose. A Data Clean Room can let both parties contribute data and restrict analysis to a reviewed template. They can use the approved match result without granting each other a raw-list SELECT path.

A data provider owns an offering. The collaboration owner defines the rules and invites accounts. An analysis runner uses only the enabled offerings and templates. A template describes how data is combined and what comes out. This pilot permits an overlap count, with template-only data access and no activation export. Activation is a separate capability for transferring approved results.

Two data providers, one approved analysis The join uses protected keys. The output describes the cohort as a group.
  1. Maple MarketRegister template-only offering to Collaboration template
  2. Beacon MediaJoin and share own offering to Collaboration template
  3. Collaboration templateReturn approved aggregate to Allowed result
Maple Market
Contributes approved synthetic match keys.
Beacon Media
Contributes its own keys independently.
Collaboration template
Joins on approved keys and aggregates.
Allowed result
Six matches in the teaching fixture. No key list.

Confirm current Collaboration Data Clean Rooms support

Use two approved Enterprise Edition or higher accounts in a supported commercial region with the current Data Clean Rooms environment installed. Snowflake’s Snowsight collaboration tutorial requires version 14.6 or later. Government and Virtual Private Snowflake deployments are excluded for this workflow. Have the administrators confirm the supported account and approved collaborator configuration, and grant appropriate collaboration privileges or the documented SAMOOHA_APP_ROLE for this sandbox.

Use the current Data sharing → Data clean rooms interface and Collaboration API underneath it. Snowflake stopped new legacy clean room creation through the old web app on October 1, 2026. Its announced remaining legacy milestones are February 1, 2027 for loss of the old UI and new legacy API creation, and June 1, 2027 for final retirement. Keep the lesson on the current collaboration path. The SQL registration path below avoids depending on Cortex Code.

Create synthetic inputs and register each offering with restricted columns

Run the Maple code in the Maple account and the Beacon code in the Beacon account. The practice role needs the warehouse, its disposable database and registration rights. Disable secondary roles before registering and linking. Each table has eight distinct synthetic identifiers. LOWER and TRIM normalize inputs for this fixture. SHA2_BINARY creates the hash and BASE64_ENCODE gives the format expected by the built-in join type. Hashes of identifiers are still sensitive and can be matched or guessed. Use approved identifiers and matching standards in real projects.

Register one offered dataset each. The specification says template_only, marks HASHED_EMAIL as a standard join input, and exposes only a generic cohort as a passthrough field. No raw email is stored in the contributed table. The source IDs beginning 03 through 08 are the six shared entities. The code blocks use independent lab databases.

Maple account. Prepare its eight inputs

SQL · configuration template
USE ROLE SAMOOHA_APP_ROLE;
USE SECONDARY ROLES NONE;
USE WAREHOUSE <approved_clean_room_warehouse>;
CREATE DATABASE LS_M19_MAPLE_ROOM;
CREATE SCHEMA LS_M19_MAPLE_ROOM.LAB;
CREATE TABLE LS_M19_MAPLE_ROOM.LAB.MATCH_INPUT AS
SELECT BASE64_ENCODE(SHA2_BINARY(LOWER(TRIM(COLUMN1)),256)) AS HASHED_EMAIL,
       'pilot' AS COHORT
FROM VALUES ('person01@example.invalid'),
            ('person02@example.invalid'),
            ('person03@example.invalid'),
            ('person04@example.invalid'),
            ('person05@example.invalid'),
            ('person06@example.invalid'),
            ('person07@example.invalid'),
            ('person08@example.invalid');

SELECT COUNT(*) AS INPUT_ROWS, COUNT(DISTINCT HASHED_EMAIL) AS DISTINCT_KEYS
FROM LS_M19_MAPLE_ROOM.LAB.MATCH_INPUT;

Beacon account. Prepare its eight inputs

SQL · configuration template
USE ROLE SAMOOHA_APP_ROLE;
USE SECONDARY ROLES NONE;
USE WAREHOUSE <approved_clean_room_warehouse>;
CREATE DATABASE LS_M19_BEACON_ROOM;
CREATE SCHEMA LS_M19_BEACON_ROOM.LAB;
CREATE TABLE LS_M19_BEACON_ROOM.LAB.MATCH_INPUT AS
SELECT BASE64_ENCODE(SHA2_BINARY(LOWER(TRIM(COLUMN1)),256)) AS HASHED_EMAIL,
       'pilot' AS COHORT
FROM VALUES ('person03@example.invalid'),
            ('person04@example.invalid'),
            ('person05@example.invalid'),
            ('person06@example.invalid'),
            ('person07@example.invalid'),
            ('person08@example.invalid'),
            ('person09@example.invalid'),
            ('person10@example.invalid');

SELECT COUNT(*) AS INPUT_ROWS, COUNT(DISTINCT HASHED_EMAIL) AS DISTINCT_KEYS
FROM LS_M19_BEACON_ROOM.LAB.MATCH_INPUT;

Maple account. Register its data offering

SQL · runnable example
USE ROLE SAMOOHA_APP_ROLE;
USE SECONDARY ROLES NONE;
CALL SAMOOHA_BY_SNOWFLAKE_LOCAL_DB.REGISTRY.REGISTER_DATA_OFFERING(
$$
api_version: 2.0.0
spec_type: data_offering
version: v1
name: maple_m19_audience
datasets:
  - alias: audience
    data_object_fqn: LS_M19_MAPLE_ROOM.LAB.MATCH_INPUT
    object_class: custom
    allowed_analyses: template_only
    schema_and_template_policies:
      hashed_email:
        category: join_standard
        column_type: hashed_email_b64_encoded
      cohort:
        category: passthrough
$$
);

Beacon account. Register its data offering

SQL · runnable example
USE ROLE SAMOOHA_APP_ROLE;
USE SECONDARY ROLES NONE;
CALL SAMOOHA_BY_SNOWFLAKE_LOCAL_DB.REGISTRY.REGISTER_DATA_OFFERING(
$$
api_version: 2.0.0
spec_type: data_offering
version: v1
name: beacon_m19_audience
datasets:
  - alias: audience
    data_object_fqn: LS_M19_BEACON_ROOM.LAB.MATCH_INPUT
    object_class: custom
    allowed_analyses: template_only
    schema_and_template_policies:
      hashed_email:
        category: join_standard
        column_type: hashed_email_b64_encoded
      cohort:
        category: passthrough
$$
);

Create, approve and join the Collaboration in Snowsight

As the approved Maple owner, check Templates for standard_audience_overlap_v0. If it isn’t registered, use the documented registration command below. The owner needs CREATE COLLABORATION and registration permissions. Beacon needs permissions to review and join and to share its offering. Review any data-access and cost commitments before joining.

  1. Maple. Open Data sharing → Data clean rooms → Create Collaboration. Name it maple_m19_overlap. Set owner alias maple with Data Provider and Analysis Runner roles. Choose maple_m19_audience_v1 and standard_audience_overlap_v0.
  2. Maple. Add Beacon using its verified ORG_NAME.ACCOUNT_NAME and alias beacon as a Data Provider. Leave its offering list empty until it joins. In Resource mapping allow the Maple runner to use both providers and the one approved template. Review the specification and select auto-join for Maple before creating.
  3. Beacon. In Collaborations → Invited, start review. After background review, use Pending Join → Join and verify identities, roles and the template. From Joined, open Data Offerings → Share Data Offering, select beacon_m19_audience_v1 and allow only the Maple runner. Submit and wait for Completed.
  4. Maple. Verify both accounts are joined and both offerings are available. If the invite or offering is missing, verify the account name, role, mapping, status and registration. Creation and review can take several minutes.
SQL · runnable example
USE ROLE SAMOOHA_APP_ROLE;
USE SECONDARY ROLES NONE;
CALL SAMOOHA_BY_SNOWFLAKE_LOCAL_DB.REGISTRY.REGISTER_STANDARD_DCR_TEMPLATES();

Run the approved overlap and interpret the expected output

In Maple, open the collaboration → Templates → standard_audience_overlap_v0 → Open in Workspaces. Run VIEW_DATA_OFFERINGS to get actual template_view_name values. Use Beacon first as p1 and Maple second as p2 because the template counts against the second source. The positive test uses the single pilot cohort on both sides. The YAML under RUN binds the approved template and join and keeps both filters empty.

The expected business result from these eight-plus-eight inputs is one pilot cohort with six matches, or 75 percent of Maple’s eight. Product result columns and privacy behavior depend on the installed template. The built-in template applies output constraints and documents a threshold for entity-identifying data. Compare the allowed aggregate after configuration. Do not assume a particular small-cohort failure code or unchanged counts when extra privacy controls are enabled.

Expected teaching result before optional privacy noise
Maple inputBeacon inputOverlapMaple match rateIndividual IDs returned
88675%None

Read the offering names in the current collaboration

SQL · runnable example
CALL SAMOOHA_BY_SNOWFLAKE_LOCAL_DB.COLLABORATION.VIEW_DATA_OFFERINGS('maple_m19_overlap');

Fill in both names and run the generated analysis

SQL · configuration template
CALL SAMOOHA_BY_SNOWFLAKE_LOCAL_DB.COLLABORATION.RUN(
  'maple_m19_overlap',
  $$
api_version: "2.0.0"
spec_type: "analysis"
name: "maple_m19_overlap_pilot"
template: "standard_audience_overlap_v0"
template_configuration:
  view_mappings:
    source_tables:
      - "<beacon_template_view_name>"
      - "<maple_template_view_name>"
  local_view_mappings:
    my_tables: []
  arguments:
    join_clauses:
      - "p1.hashed_email_b64_encoded = p2.hashed_email_b64_encoded"
    count_column:
      - "hashed_email_b64_encoded"
    my_where_clause: ""
    source_where_clause: ""
    my_group_by:
      - "p2.cohort"
    source_group_by:
      - "p1.cohort"
$$
);

Verify denials, monitor runs and retire the pilot

In the invited account confirm the partner’s source database has no direct SELECT path. In the collaboration, confirm an unauthorized runner or unapproved template cannot run and the intended result returns no email or key list. Check that raw SQL access was not approved for either offering and that no activation template was shared. If a result is denied or suppressed, inspect the allowed template, role mappings and output limits instead of relaxing them.

Even aggregates can reveal information if a runner repeatedly asks near-identical questions or selects tiny groups. Review group thresholds, allowed segmentation, repeat-query limits and applicable differential privacy. Differential privacy uses a budget and may change reported values. Restrict any approved export and retain audit evidence. In the current Snowsight Activity tab, compare run ID, runner, template, status and time with the approved job.

The collaboration owner tears down only the named pilot from Collaborations after approval. This revokes access to the collaboration and cannot be undone. Each account independently removes its disposable offering registrations and sample database when no other approved collaboration uses them. Do not uninstall the shared account environment as part of a lesson cleanup.

Module 18 · Protect query results with governance policies →

Interview practice

Explain the decision and the evidence you would use to test it.

What does a Data Clean Room add beyond a share?

It can let multiple parties contribute data while allowing only reviewed analyses. In this example the partner approves a count, not a list of matched people.

How would you verify an overlap template?

I would check each input key is normalized and unique, confirm which offering is p1 and p2, compare the expected six matches and verify the output contains no customer keys.

Does a clean room guarantee no private information is exposed?

The guarantee depends on the configuration and use. I would restrict templates, roles and output, test small and repeated cohorts, and audit whether any activation or export occurred. A hash alone is not a privacy guarantee.

Words used in this lesson
Data clean room
Controlled collaboration environment for approved analyses over more than one party’s data.
Data offering
A contributed dataset plus rules for how it may be used.
Analysis template
A reviewed query pattern with approved inputs and outputs.

See how it works

Choose a step to explore the idea at your own pace.

Open the interactive explanation
Interactive explainer1 / 1

Snowflake Data Clean Rooms: run a governed customer overlap

Maple Market
Beacon Media
Collaboration template
Allowed result

Two data providers, one approved analysis

The join uses protected keys. The output describes the cohort as a group.

Automatic playback is off for reduced motion. Select any step or use Previous and Next. Illustrations explain behavior; they are not live measurements.

Read the complete diagram explanation
  1. Two data providers, one approved analysis

    The join uses protected keys. The output describes the cohort as a group.

    Maple Market → Beacon Media → Collaboration template → Allowed result

Try the SQL or command

Read → predict → run in your learning environment → compare. You can also learn by reading without an account.

New to SQL? Where to run it and how to read it

A query is a question written in SQL. Snowflake runs it and returns a result table. This website shows examples; it does not connect to your account.

  1. No account yet? Read and predict the output first. Follow the account and Snowsight lesson when you are ready.
  2. For SQL practice, use a learning account in Snowsight and select an authorized role and warehouse. A role determines permissions; a warehouse supplies processing power. Follow the example’s database/schema setup when it refers to stored objects.
  3. Read the entire example, including comments beginning with --. Run the selected statement or labeled block in the stated order. Examples labeled Python, shell or HTTP belong in that client, not in a SQL editor.
  4. Compare values and row counts with the explained result. If an example deliberately causes an error, follow its rollback and cleanup steps before continuing.
SELECT / FROM
Choose the values to return / identify their input.
VALUES / COLUMN1
VALUES supplies tiny example rows. COLUMN1 means their first column, COLUMN2 their second.
AS / WITH
AS gives a result a readable name. WITH names a temporary query step within one statement.
NULL / ::
NULL means missing or unknown. The :: notation converts a value to a named data type.
Session
One connection and its settings. Keep related transaction steps in the same session.
Database.schema.table
A full address for stored data. It is separate from the warehouse that processes queries.

Need the L2_OBJECTS_LAB setup? Open the first database-object lesson →

Help with common practice errors
  • No active warehouse: select a warehouse your role can use. Do not assume you need to create a new one.
  • Object missing or not authorized: check the full name, required setup and active role. Ask the account owner for access if needed.
  • Object already exists: setup may already have run. Read the current state or choose a fresh lab name consistently; do not add OR REPLACE blindly.
  • Different result: check whether an earlier INSERT or UPDATE changed the data. VALUES examples provide their own fresh input for each statement.

Before running this lesson

The datasets are fictional. Results are expected or simulated. Run live steps only in approved test accounts with the documented roles, regions, and feature access.

Check your understanding

Choose an answer, then check your reasoning. This is practice, not a scored test.

Which result fits the approved Maple and Beacon workflow?

Try it yourself

A new analyst wants to add an exact postal-code split. What checks should happen before accepting it?

Compare your reasoning

Check business need, cohort size, repeated query risk and any output or privacy policy. Review and test the approved template with a narrow, synthetic input before enabling it.

Connect this lesson to the learning path

Official sources and curriculum

Module 19 · See module scope

By Rohit Ray · Independent educational lesson · Explore this visual lab