Data Collaboration · Topic 4 of 5
Direct Shares, Secure Objects, Resharing and Data Clean Rooms
Snowflake direct shares, secure views and UDFs, database roles, per-consumer filtering, the resharing rules and how Data Clean Rooms protect shared data.
- 6 min
- Direct share: named accounts, same region, no listing metadata.
- Secure views, secure materialized views and secure UDFs hide definitions and are the way to share filtered data.
- CURRENT_ACCOUNT() in a secure view filters rows per consumer.
What it is
A direct share is the simplest form of Secure Data Sharing: a provider names specific objects and specific consumer accounts in one region. The secure data sharing features around it control exactly what each consumer can see: secure views, secure UDFs, database roles and filters on the consumer's account.
Resharing asks whether a consumer can pass shared data on. Data clean rooms go one step further and let parties analyze each other's data without either side seeing the other's raw rows.
How it works
Direct shares
A direct share is created with CREATE SHARE, filled with GRANT ... TO SHARE and sent with ALTER SHARE ... ADD ACCOUNTS. It suits a small number of known partners.
| Feature | Direct share | Listing |
|---|---|---|
| Consumers | Specific accounts you add by identifier | Specific accounts or everyone on Snowflake Marketplace |
| Regions | Same region as the provider only | Any region, with Cross-Cloud Auto-Fulfillment |
| Metadata | None beyond the share | Title, description, sample queries, usage metrics |
| Paid access | No | Free, limited trial or paid options |
A direct share can later be turned into a listing when it needs more reach.
Secure views and secure UDFs
Shares should expose secure views, secure materialized views and secure UDFs rather than raw tables when data must be filtered or logic hidden. A secure object hides its definition from users who do not own it, and the optimizer skips some rewrites that could reveal filtered rows. The trade-off is that secure views can run slower than regular views.
CREATE SECURE VIEW sales.shared.orders_v AS
SELECT o.* FROM sales.public.orders o
JOIN sales.public.access_map m ON o.region = m.region
WHERE m.consumer_account = CURRENT_ACCOUNT();
CURRENT_ACCOUNT() returns the consumer's account when the view is queried through a share. With a mapping table, one share can show each consumer only its own rows.
"Share one dataset with many customers, each seeing only their own rows" is answered by a secure view that filters on CURRENT_ACCOUNT() with a mapping table, not by one share per customer with copied tables.
Database roles in shares
A provider can create database roles, grant different objects to each, and grant the database roles to the share. The consumer then grants each database role to its own account roles, so different consumer teams see different subsets. A shared database role does not support future grants.
Sharing and resharing
The baseline rule: shared data is read-only, and a consumer cannot add objects from an imported database to its own share by default. Data the consumer did not create is not its to redistribute.
Snowflake documents one controlled exception for direct shares:
- Resharing must be enabled for the direct share. The consumer sees whether it is allowed in the
resharing_settingscolumn of SHOW DATABASES. - It works only with accounts in the consumer's own organization, and not across regions.
- Tables, dynamic tables and views are reshared only through a secure view in the consumer's own database; UDFs cannot be reshared.
- Downstream accounts see only data that the resharing account itself can see.
If you remember one thing: resharing never lets a consumer pass data to another company. Wider distribution is the provider's decision and uses the provider's own shares or listings.
Data clean rooms
A data clean room lets two or more parties combine data for analysis, such as matching customer overlap between a retailer and an advertiser, while neither sees the other's row-level data. Snowflake Data Clean Rooms is built on Secure Data Sharing, and collaborations are managed in Snowsight.
- Collaborators take roles: an owner creates the collaboration and invites others, data providers offer data, and analysis runners run allowed analyses.
- Analyses run only through approved templates (JinjaSQL queries), so a runner cannot write arbitrary SQL against the other party's data.
- Data providers apply policies that control what results can reveal.
- Every collaborator needs a Snowflake account; trial accounts are not supported, and data providers need Enterprise Edition or higher.
| Need | Best fit |
|---|---|
| Partner needs to query your rows directly | Direct share or listing |
| Partner must never see your raw rows, only approved aggregates | Data clean room |
A secure view hides logic and filters rows, but the consumer can still query every row it is allowed to see. When the requirement is "joint analysis without exposing individual records to either party", choose a data clean room.
Common mistakes
Sharing raw tables when filtering is required. Add a secure view and share the view, not the base table.
Using a regular view where logic must stay hidden. By default a share accepts only secure objects. A regular view can be added only to a share created with SECURE_OBJECTS_ONLY = FALSE, a setting that cannot be turned back, and it does not get the protections of a secure view. When the definition or filtering logic must stay private, share a secure view.
Believing consumers can forward shared data freely. Consumers cannot reshare outside their own organization; any resharing stays inside the organization and region.
Using a direct share for a consumer in another region. Direct shares are same-region only.
Confusing a clean room with a share. In a share the consumer reads rows; in a clean room it only runs approved templates.
What to remember for the exam
- Direct share: named accounts, same region, no listing metadata.
- Secure views, secure materialized views and secure UDFs hide definitions and are the way to share filtered data.
- CURRENT_ACCOUNT() in a secure view filters rows per consumer.
- Database roles let a provider share different object sets within one share.
- Imported data is read-only; resharing is limited to the consumer's own organization and region and goes through a secure view.
- Data clean rooms allow joint analysis through approved templates without exposing raw rows.
Check yourself
How can one share give each of 50 customers only their own rows?
Share a secure view that filters on CURRENT_ACCOUNT() against a mapping table of customer accounts.
Can a consumer reshare imported data with a different company?
No. Resharing, where enabled, is limited to accounts in the consumer's own organization and region.
What makes a data clean room different from a direct share?
Clean room users run only approved templates and receive results, never the other party's raw rows.
Topic 4 of 5 in Data Collaboration
Test yourself on Data Collaboration
The full Snowflake SnowPro Core COF-C03 question bank has 845 questions, with timed practice exams and an explanation for every answer.
This study guide is independent and is not affiliated with, endorsed by, or sponsored by Snowflake. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.