Create a data clean room (publisher)

내 진행 상황 확인하기

/ 25

Add data to the data clean room (publisher)

내 진행 상황 확인하기

/ 25

Subscribe to the data clean room (subscriber)

내 진행 상황 확인하기

/ 25

Query the data to test secure data sharing implementation (subscriber and publisher)

내 진행 상황 확인하기

/ 25

이 실습에는 학습을 지원하는 AI 도구가 통합되어 있을 수 있습니다.

GSP1333

Google Cloud self-paced labs

Overview

Want to protect your sensitive data in BigQuery by restricting query access? With data clean rooms, you can now do that in an easily implemented and managed way! A data clean room is an environment to share sensitive data where raw access can be prevented and query restrictions can be enforced. Only users or groups that are added as subscribers to a data clean room can subscribe to the shared data. Data clean rooms provide a security-enhanced environment. Multiple parties can share, join, and analyze their data assets without moving or revealing the underlying data.

BigQuery data clean rooms are built on the BigQuery sharing (formerly Analytics Hub) platform. Standard BigQuery sharing data exchanges allow you to share data across organizations at scale. Data clean rooms help you address sensitive and protected data-sharing use cases. Specifically, data clean rooms provide additional security controls to help protect the underlying data and enforce analysis rules that the data owner defines.

The following diagram provides an overview of the BigQuery sharing data exchange architecture. First, the owner creates and manages the data clean room through the BigQuery sharing platform. They add shareable data and grant access to specific users. Then, users who have been granted access can query data in the clean room from their own projects. The BigQuery sharing platform enforces access rules defined by the owner. These rules include differential privacy and privacy budgets.

BigQuery sharing data exchange architecture

What is differential privacy?

Differential privacy is an anonymization technique that limits the personal information that is revealed in a query output. Differential privacy is considered to be one of the strongest privacy protections. To learn more, refer to the What is differential privacy? documentation.

Privacy budget

The privacy budget is like a limit on how much noise you can add. Every time you perform a calculation or analysis on the data, you use up some of your privacy budget. Once the budget is spent, you can't add any more noise, and further analysis might risk revealing private information.

The privacy budget is controlled by an epsilon (ε) value established by the data clean room publisher.

  • Higher epsilon values mean less noise is added, resulting in more accurate results but weaker privacy protection.
  • Lower epsilon values mean more noise is added, resulting in less accurate results but stronger privacy protection.

Use cases

  • Campaign planning and audience insights: Let two parties (such as sellers and buyers) mix first-party data and improve data enrichment in a privacy-centric way.
  • Activation: Combine customer data with data from other parties to enrich customer understanding, enabling improved segmentation capabilities and more effective media activation.
  • Financial services: Improve fraud detection by combining sensitive data from other financial and government agencies. Build credit risk scoring by aggregating customer data across multiple banks.
  • Healthcare: Share data between doctors and pharmaceutical researchers to learn how patients are reacting to treatments. Supply chain, logistics, and transportation. Combine data from suppliers and marketers to get a complete picture of how products perform throughout their lifecycle.
  • Supply chain, logistics, and transportation: Combine data from suppliers and marketers to get a complete picture of how products perform throughout their lifecycle.

What you'll learn

In this lab, you learn how to perform the following tasks:

  • Create a data clean room and add data to it as a publisher.
  • Enable secure data sharing for a publisher's table that contains sensitive information.
  • Apply a differential privacy analysis rule to the table to protect individual privacy.
  • Subscribe to a data clean room as a subscriber.
  • Query the data as the subscriber and publisher to test that secure data sharing is working as intended.

Prerequisites

To complete this lab, you should be familiar with BigQuery.

Setup and requirements

Note: To begin this lab, follow the instructions to log into the Publisher project:

as the Publisher username: .

Before you click the Start Lab button

Read these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources are made available to you.

This hands-on lab lets you do the lab activities in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials you use to sign in and access Google Cloud for the duration of the lab.

To complete this lab, you need:

  • Access to a standard internet browser (Chrome browser recommended).
Note: Use an Incognito (recommended) or private browser window to run this lab. This prevents conflicts between your personal account and the student account, which may cause extra charges incurred to your personal account.
  • Time to complete the lab—remember, once you start, you cannot pause a lab.
Note: Use only the student account for this lab. If you use a different Google Cloud account, you may incur charges to that account.

How to start your lab and sign in to the Google Cloud console

  1. Click the Start Lab button. If you need to pay for the lab, a dialog opens for you to select your payment method. On the right is the Lab setup and access panel with the following:

    • The Open Google Cloud console button
    • The temporary credentials (username and password) that you must use for this lab
    • Other information, if needed, to step through this lab

    Note that the lab timer is located near the top of the page, showing the remaining time.

  2. Click Open Google Cloud console (or right-click and select Open Link in Incognito Window if you are running the Chrome browser).

    The lab spins up resources, and then opens another tab that shows the Sign in page.

    Tip: Arrange the tabs in separate windows, side-by-side.

    Note: If you see the Choose an account dialog, click Use Another Account.
  3. If necessary, copy the Username below and paste it into the Sign in dialog.

    {{{user_0.username | "Username"}}}

    You can also find the Username in the Lab setup and access panel.

  4. Click Next.

  5. Copy the Password below and paste it into the Welcome dialog.

    {{{user_0.password | "Password"}}}

    You can also find the Password in the Lab setup and access panel.

  6. Click Next.

    Important: You must use the credentials the lab provides you. Do not use your Google Cloud account credentials. Note: Using your own Google Cloud account for this lab may incur extra charges.
  7. Click through the subsequent pages:

    • Accept the terms and conditions.
    • Do not add recovery options or two-factor authentication (because this is a temporary account).
    • Do not sign up for free trials.

After a few moments, the Google Cloud console opens in this tab.

Note: To access Google Cloud products and services, click the Navigation menu or type the service or product name in the Search field. Navigation menu icon and Search field

Task 1. Create a data clean room (publisher)

For this task, be sure that you have logged into the Publisher project () as the Publisher username ().

In this task, you act as the publisher () to create a data clean room () and assign the required permissions.

  1. On the Navigation menu (Navigation menu), click BigQuery > Sharing (Analytics Hub).

  2. Click Create clean room.

  3. Create a secure environment for privacy-preserving analysis while restricting access to the underlying data with the following details:

    Parameter Configuration
    Project
    Location type Multi-region
    Multi-region US (multiple regions in the United States)
    Clean room name
    Primary contact
    Description Patient Data Analysis
  4. Click Create clean room and leave the remaining settings as their defaults.

  5. Use the following details in the Clean Room Permissions (optional) section to add the Publisher username as the clean room owner and the Subscriber username as data contributor and subscriber to the clean room.

    Parameter Configuration
    Clean room owners
    Data contributors ,
    Subscribers
  6. Click Set permissions.

  7. Locate the row for the clean room name named (). Under Actions, click the More actions icon (more menu icon), and select Set permissions.

  8. Click Add principal.

  9. In the Add principals section, enter the subscriber username for the principal:

  10. For Select a role, search for Analytics Hub Subscription Owner, and then select Analytics Hub Subscription Owner from the search results.

  11. Click Save.

Click Check my progress to verify the objective. Create a data clean room (publisher)

Task 2. Add data to the data clean room (publisher)

For this task, be sure that you remain logged into the Publisher project () as the Publisher username ().

In this task, you act as the publisher and clean room owner (). You will create a new listing in the data clean room () for a new view named covid_data with analysis rules implemented.

  1. Click on the data clean room named .

  2. Click Add data.

When creating a view, you can choose all source data columns. Alternatively, select specific columns to include in the new view. For this data, you choose all the source columns as part of the new view in next steps.

  1. In Source data, for Dataset, enter: .gcc_bq_dataset

  2. In Source data, for Table / view name, select county_14d.

  3. Enable the option for Use all columns.

  4. In Store new view, enter the view name: covid_data

  5. In Metadata, enter the value for Primary contact:

  6. Click Next.

  7. In the Analysis rules section, use the following details to define analysis rules for the shared table named county_14d, and leave the remaining settings as their defaults:

    Parameter Configuration
    Rule type Differential privacy
    Filter Enable Allow join on columns named county_fips_code and state_name; Enable Privacy unit column on column named new_deaths
    Total epsilon 1000
    Maximum epsilon per query 15
    Total delta 0.5
    Delta per query 0.1
    Join condition Join not required
Note: To add state_name as a join column and set new_deaths as a Privacy unit column, you need to expand the rows per page displayed or use that arrows at the bottom right of the table to see more column names.
  1. Click Next, and then review the configurations.

  2. Click Add data.

Note: A view covid_data is created for your data and is added as a listing to the data clean room named . The source table or view itself isn't added.

Leave the browser tab for the Publisher project open, as you proceed to the next task.

Click Check my progress to verify the objective. Add data to the data clean room (publisher)

Task 3. Subscribe to the data clean room (subscriber)

For this task, be sure that you have logged into the Subscriber project () as the Subscriber username ().

Subscribers of a data clean room incur compute charges when querying shared data protected by a differential privacy rule. In this task, you explore how shared data is accessible in the Subscriber project. As the Subscriber (), you subscribe to the data clean room (). This creates a linked dataset for all listings in the data clean room.

  1. In a new Incognito or private browser window, sign into the Subscriber Project () as the secondary user ().

  2. On the Navigation menu (Navigation menu), click BigQuery > Sharing (Analytics Hub).

  3. Click Search listings.

  4. In the Filters pane, under Listings, apply the filter for Clean rooms.

  5. In the Results, click on the data clean room named .

  6. Click Subscribe.

  7. For Project, enter the Subscriber Project ID:

  8. Click Subscribe.

  9. On the Navigation menu (Navigation menu), click BigQuery > Studio.

  10. Expand the arrow next to the Subscriber Project ID () to expand the list of items.

  11. Click on the subscribed clean room table named , and then click the Details tab to see that it has a Differential privacy policy.

Note: If you do not see the subscribed clean room table, wait a few minutes for the subscription operations of the data clean room () to complete. Then, refresh the BigQuery page.

Click Check my progress to verify the objective. Subscribe to the data clean room (subscriber)

Task 4. Query the data to test secure data sharing implementation (subscriber and publisher)

For this task, be sure that you query the data in BigQuery as the specified user (subscriber or publisher) in the specified project (subscriber or publisher) for each query, so that you can fully test that secure data sharing is working as intended.

Test 1 - Query data with and without differential privacy as the subscriber

When a differential privacy rule is applied to a shared table or view, users cannot directly query it using standard SQL. In this section, you act as the subscriber and use differential privacy to query the shared data instead of standard SQL.

For test 1, execute the following queries in the Subscriber project () as the Subscriber username ().

  1. On the BigQuery Studio page, click on the Untitled query tab, paste the following query, and click Run:
-- Subscriber project query SELECT COUNT(*) FROM `{{{project_1.project_id|project_id}}}.{{{project_0.startup_script.clean_room_name | clean_room_name}}}.covid_data`;

Output returns a message that differential privacy is being enforced:

You must use SELECT WITH DIFFERENTIAL_PRIVACY or GROUP BY privacy unit column because a privacy policy has been set by a data owner.
  1. Replace the previous query with the following query, which uses SELECT WITH DIFFERENTIAL_PRIVACY:
-- Subscriber project query SELECT WITH DIFFERENTIAL_PRIVACY COUNT(*) FROM `{{{project_1.project_id|project_id}}}.{{{project_0.startup_script.clean_room_name | clean_room_name}}}.covid_data`;

Output returns the desired count:

44267

You have observed that users cannot directly query protected tables with standard SQL. They must explicitly include the WITH DIFFERENTIAL PRIVACY clause in their queries. This ensures that all queries adhere to the defined privacy protections.

Test 2 - Query data to see the differences in data returned to the subscriber and publisher

Differential privacy adds slight noise to the values returned in query results, rather than showing the actual values. This noise helps to mask individual data points while preserving overall trends and insights. Users should be aware that the values they see are not the exact, raw values but instead are perturbed with some noise added for privacy.

For this first query below, execute it in Publisher project () as the Publisher username ().

  1. Execute the following query in BigQuery within the Publisher project to see the raw data that is returned to the publisher without the noise added:
-- Publisher project query SELECT county_name, COUNT(new_deaths) FROM `{{{project_0.project_id|project_id}}}.gcc_bq_dataset.county_14d` GROUP BY county_name ORDER BY county_name;

Output returns data with no noise:

Row county_name count
1 Abbeville 14
2 Acadia 14
3 Accomack 14
4 Ada 14
5 Adair 56
6 Adams 168
7 Addison 14

For the second query, execute it in the Subscriber project () as the Subscriber username ().

  1. Execute the following query to see the data that is returned to the subscriber with some minor noise added:
-- Subscriber project query SELECT WITH DIFFERENTIAL_PRIVACY county_name, COUNT(new_deaths) FROM `{{{project_1.project_id|project_id}}}.{{{project_0.startup_script.clean_room_name | clean_room_name}}}.covid_data` GROUP BY county_name ORDER BY county_name;

Output returns data with some minor noise:

Row county_name count
1 Abbeville 14
2 Acadia 14
3 Accomack 14
4 Ada 13
5 Adair 55
6 Adams 167
7 Addison 15

The noise, or difference between the raw data and differentially private data, is due to the epsilon (ε) value established by the data clean room publisher. In this case, a higher epsilon value results in less noise, so the difference between the raw and subscribed data is minor, but a data clean room publisher can increase the epsilon value as desired for their use case.

Test 3 - Query the data to test granular control over data joins using a column that has not been restricted from joins

For test 3, execute the following query in the Subscriber project () as the Subscriber username ().

A significant advantage of using differential privacy in BigQuery sharing is the granular control it offers over data joins. Publishers specify which columns are allowed in joins. This prevents sensitive data combinations from being revealed. Previously, as the publisher, you only allowed state_name and country_fips_code columns for join. In tests 3 and 4, you query the data to test granular control over data joins.

  • Execute a query that joins another table with the original shared table on the state_name column that has not been restricted from joins:
-- Subscriber project query SELECT WITH DIFFERENTIAL_PRIVACY a.county_name,b.state_name,count(a.new_deaths) new_deaths_count FROM `{{{project_1.project_id|project_id}}}.{{{project_0.startup_script.clean_room_name | clean_room_name}}}.covid_data` a JOIN `{{{project_1.project_id|project_id}}}.gcc_bq_dataset.county_14d` b on a.state_name=b.state_name GROUP BY 1,2;

In this case, you are able to perform a join and get the results using the state_name column.

Row county_name state_name new_deaths_count
1 Mcpherson Nebraska 53428
2 Motley Texas 140563
3 Jerauld South Dakota 39619
4 Catron New Mexico 19056
5 Smith Kansas 60030
6 Adair Iowa 62562
7 Jack Texas 147420
8 Colfax Nebraska 53792
9 Ballard Kentucky 61495
10 Pecos Texas 155751

Test 4 - Query the data to test granular control over data joins using a column that has been restricted from joins

For test 4, execute the query in the Subscriber project () as the Subscriber username ().

In this section, you attempt to execute a query with join conditions on a restricted column named forecast_date.

  • Execute a query that joins another table with the original shared table on the forecast_date column that has been restricted from joins:
-- Subscriber project query SELECT WITH DIFFERENTIAL_PRIVACY a.county_name,b.state_name,count(a.new_deaths) new_deaths_count FROM `{{{project_1.project_id|project_id}}}.{{{project_0.startup_script.clean_room_name | clean_room_name}}}.covid_data` a JOIN `{{{project_1.project_id|project_id}}}.gcc_bq_dataset.county_14d` b on a.forecast_date=b.forecast_date GROUP BY 1,2;

Output returns a message that joins are not allowed on the restricted column:

Join occurring on a restricted column.

Publishers retain control over how shared data is used, even with differential privacy applied. They can restrict users' ability to copy or export the data, ensuring that the data remains within the secure environment of BigQuery sharing.

Test 5 - Query the data to test the privacy budget as the subscriber

For test 5, execute the query in the Subscriber project ( as the Subscriber username ().

Each differential privacy rule has a privacy budget that gets consumed with every query. Once this budget is exhausted, subscribers of the clean room cannot query your shared data. This mechanism prevents excessive information leakage and enforces privacy limits. In this section, you run additional queries to test the privacy budget.

  • Execute the following query to test the privacy budget as the subscriber. You may need to run the query a few times to receive the message that the privacy budget has been reached.
-- Subscriber project query SELECT WITH DIFFERENTIAL_PRIVACY county_name, COUNT(new_deaths) FROM `{{{project_1.project_id|project_id}}}.{{{project_0.startup_script.clean_room_name | clean_room_name}}}.covid_data` GROUP BY county_name ORDER BY county_name; Note: When you execute the command multiple times, you get an error regarding the privacy budget. This prevents excessive information leakage and enforces privacy limits.

Output indicates that the privacy budget has been reached:

Privacy budget is not sufficient for table '{{{project_1.project_id|project_id}}}.{{{project_0.startup_script.clean_room_name | clean_room_name}}}.covid_data' in this query.

Click Check my progress to verify the objective. Query the data to test secure data sharing implementation (subscriber and publisher)

Congratulations!

You have successfully enabled secure data sharing while protecting individual privacy with differential privacy in data clean rooms.

Next steps / Learn more

Google Cloud training and certification

...helps you make the most of Google Cloud technologies. Our classes include technical skills and best practices to help you get up to speed quickly and continue your learning journey. We offer fundamental to advanced level training, with on-demand, live, and virtual options to suit your busy schedule. Certifications help you validate and prove your skill and expertise in Google Cloud technologies.

Manual Last Updated May 27, 2026

Lab Last Tested May 27, 2026

Copyright 2026 Google LLC. All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.

시작하기 전에

  1. 실습에서는 정해진 기간 동안 Google Cloud 프로젝트와 리소스를 만듭니다.
  2. 실습에는 시간 제한이 있으며 일시중지 기능이 없습니다. 실습을 종료하면 처음부터 다시 시작해야 합니다.
  3. 화면 왼쪽 상단에서 실습 시작을 클릭하여 시작합니다.

시크릿 브라우징 사용

  1. 실습에 입력한 사용자 이름비밀번호를 복사합니다.
  2. 비공개 모드에서 콘솔 열기를 클릭합니다.

콘솔에 로그인

    실습 사용자 인증 정보를 사용하여
  1. 로그인합니다. 다른 사용자 인증 정보를 사용하면 오류가 발생하거나 요금이 부과될 수 있습니다.
  2. 약관에 동의하고 리소스 복구 페이지를 건너뜁니다.
  3. 실습을 완료했거나 다시 시작하려고 하는 경우가 아니면 실습 종료를 클릭하지 마세요. 이 버튼을 클릭하면 작업 내용이 지워지고 프로젝트가 삭제됩니다.

현재 이 콘텐츠를 이용할 수 없습니다

이용할 수 있게 되면 이메일로 알려드리겠습니다.

감사합니다

이용할 수 있게 되면 이메일로 알려드리겠습니다.

한 번에 실습 1개만 가능

모든 기존 실습을 종료하고 이 실습을 시작할지 확인하세요.

시크릿 브라우징을 사용하여 실습 실행하기

이 실습을 실행하는 가장 좋은 방법은 시크릿 모드 또는 시크릿 브라우저 창을 사용하는 것입니다. 개인 계정과 학생 계정 간의 충돌로 개인 계정에 추가 요금이 발생하는 일을 방지해 줍니다.

실습을 시작하려면 이 간단한 단계를 완료하세요.