Data Clean Rooms Developer Guide

This topic provides guidelines for users who want to create or manage Snowflake Data Clean Rooms collaborations programmatically.

Development tools

These are the main developer tools for Snowflake Data Clean Rooms collaborations:

  • Coding environment: Any coding environment that can run stored procedures in your Snowflake account will work. Most developers use worksheets in Snowsight (the browser-based tool) or the Snowflake CLI.
  • Cortex Code: Data Clean Room procedures are also available in an agentic experience via Cortex Code.

Setting up your environment

Here are some tips for setting up your coding environment to use the Snowflake Data Clean Rooms API effectively.

Using the Collaboration API

Snowflake provides the Data Clean Rooms Collaboration API to create and manage collaborations. This API consists of stored procedures that can be run in any environment that can access your Snowflake account. This includes Snowsight notebooks, workspaces, worksheets and the Snowflake CLI.

The documentation here shows SQL usage, but you can also use Python or any other supported Snowflake language.

You can grant users access to the complete API or a subset of it through specific DCR privileges.

Note

You need proper DCR privileges to use the Collaboration API. You can grant limited access to specific procedures for sub-groups of users through fine-grained role-based access control.

The SAMOOHA_APP_ROLE has pre-configured access to the entire API.

Choosing a warehouse

You must use the Collaboration API in a warehouse that your role has the USAGE privilege on. APP_WH is one of a number of warehouses that you can use. Choose the appropriate warehouse for your needs.

Any standard warehouse works for general collaboration editing, creation, or deletion commands. Consider using larger warehouses, or Snowpark-optimized warehouses, when running large analyses, such as machine learning workloads. If you use a Snowpark-optimized warehouse for reviewing or joining a collaboration, make sure MAX_CONCURRENCY_LEVEL is set to a value equal to or greater than 2.

Setting up testing accounts

You should have at least two separate accounts in which you have full coding access, to be able to develop and test multi-party collaborations.

Depending on your use case, you might also want a Snowflake test account in a different cloud hosting region to test cross-cloud behavior.

Name your test Snowflake accounts meaningfully to indicate their typical usage: for example, “Cross-cloud account” or “Standard Edition account.” This can help when you have multiple test accounts and must choose an account on the clean rooms login page.

Iterating quickly in a same-organization collaboration

When every collaborator in a collaboration belongs to the same organization, Snowflake skips the automated security scan that otherwise runs when you create the collaboration and each time you add a template that references a code spec. The scan accounts for most of the wait time in both cases, so a same-organization collaboration is a much faster environment for developing and testing code specs and templates.

A development cycle in a same-organization collaboration looks like this:

  1. Create a collaboration whose collaborators are all accounts in your own organization. For guidance on which accounts to use, see Setting up testing accounts.

  2. Register your code specs and templates and add the templates to the collaboration. Iterate as much as you need: each new version becomes usable without waiting for a scan.

  3. Run analyses to validate your results.

  4. Before you add collaborators from other organizations, confirm that your collaboration passes the security scan. Turn the scan on in either of these ways, and iterate until it passes:

    • Create a separate test collaboration that sets distribution: external, and add your templates to it. Your development collaboration stays unscanned, so you can continue to use it for iterating on your templates.
    • Set distribution: external on the development collaboration itself. We recommend doing this only when you’re finished iterating, because the setting is permanent.
  5. Add the collaborators from other organizations to the collaboration, or create a new collaboration that uses the code specs and templates you verified. Because code specs and templates are registered in your account’s registry rather than in a particular collaboration, a new collaboration can reference the same registered template without you registering them again.

For how Snowflake decides whether to run the scan, and how the override interacts with that, see the distribution field in the collaboration specification.

References and resources

The following topics are useful for Snowflake Data Clean Room developers.