What you will be able to do
- Build a share that exposes a secure view through a database role, and check what it grants with SHOW GRANTS TO SHARE
- Explain why shared objects should be secure views or secure UDFs, and test one as a consumer with SIMULATED_DATA_SHARING_CONSUMER
- Decide when a reader account fits, and predict what its users can and cannot do
- Configure a listing's visibility, access option and cross-region auto-fulfillment, including the manifest fields
- Use aggregation-style privacy policies to control how consumers query data you have already shared
Key concept
Provider-controlled exposure — In Secure Data Sharing, the provider decides which surface a consumer touches. That surface is usually a secure view or secure UDF, often with a privacy policy on it, and rarely a raw table. Every sharing mechanism here, whether a share, a reader account or a listing, delivers that surface. None of them filter data on their own.
1.Shares and the database roles granted to them
A share is the object that carries privileges from a provider account to one or more consumer accounts. Creating one takes the ACCOUNTADMIN role or a role with the global CREATE SHARE privilege. To put objects into the share, that role also needs OWNERSHIP on the shared database, or USAGE on it granted WITH GRANT OPTION. Once the objects are in place, ALTER SHARE ... SET ACCOUNTS names the consumers.
Objects can enter a share in two ways. You can grant USAGE and SELECT straight to the share. Or you can grant them to a database role and then grant that role to the share. A database role is a role that lives inside a database (see Account roles, database roles, SNOWFLAKE database roles and application roles). Granting one to a share packages a defined set of privileges inside the shared database, so the share carries that bundle instead of a loose list of grants. In the reference script, the share still needs USAGE on the database itself before the database role is granted to it.
create database role mydb.dr1; grant usage on database mydb to database role mydb.dr1; grant usage on schema mydb.public to database role mydb.dr1; grant select on mydb.public.paid_sensitive_data to database role mydb.dr1; grant usage on database mydb to share mydb_shared; grant database role mydb.dr1 to share mydb_shared;Run SHOW GRANTS TO SHARE before you add any accounts. It is the basic check of what a share actually exposes. One detail confuses first-time reviewers: a secure view appears in that output as a table, so an auditor who sees a table listed has not necessarily found a table that was shared directly.
Checkpoint 1 of 5· Fill the gap
This is Option 1 from the reference script: privileges go into a database role, and the role is then attached to the share. Which keyword completes the final statement so that the bundled privileges reach consumer accounts?
create database role mydb.dr1; grant usage on database mydb to database role mydb.dr1; grant usage on schema mydb.public to database role mydb.dr1; grant select on mydb.public.paid_sensitive_data to database role mydb.dr1; grant usage on database mydb to share mydb_shared; grant database role mydb.dr1 to ? mydb_shared;The database role packages USAGE and SELECT inside the shared database, and granting that role to the share is how the bundle travels to consumers. Granting it to an account role or straight to an account would not put it in the share. Consumers are named later with ALTER SHARE ... SET ACCOUNTS.
Source: docs.snowflake.comSources1
2.Why shared objects must be secure views and secure UDFs
A secure view closes two leaks that a standard view leaves open. First, some internal optimizations for ordinary views read the base tables directly. User code such as a UDF, or a query built to raise an error, can then expose rows the view was meant to hide. Second, anyone who can see a standard view can usually read its definition, which reveals the underlying tables and the filter logic. Secure views skip those optimizations. Their definitions are visible only to users granted the role that owns the view.
SELECT *
FROM widgets_view
WHERE 1/iff(color = 'Purple', 0, 1) = 1;If any purple widget exists, the expression divides by zero and the query fails. That failure tells the user purple rows exist even though the user never saw one. In a share, the person running that probe works in another company's account, so this guidance is a strong recommendation, not a matter of style. The cost is speed: secure views can run more slowly. Make a view secure when it exists for privacy, not when it exists only to simplify queries.
The reference layout uses two schemas. A private schema holds the base table and a mapping table that links access IDs to consumer account names. A public schema holds the secure view, which joins the two on CURRENT_ACCOUNT(). Only the public schema and the secure view go into the share. On multi-terabyte base tables, define clustering keys so the filtering in the secure view does not slow consumer queries.
Several tools let you check a secure object from the provider side. Setting the session parameter SIMULATED_DATA_SHARING_CONSUMER to a consumer account name makes your queries against the view return exactly what that account would see. The IS_SECURE column in the Information Schema and Account Usage VIEWS views shows whether a view is secure. Secure view definitions are hidden from SHOW VIEWS, GET_DDL and the Information Schema for unauthorized users. They remain readable through the Account Usage VIEWS view, and the least-privileged way to grant that access is the SNOWFLAKE.OBJECT_VIEWER database role. Query Profile never shows a secure view's internals, even to its owner.
Checkpoint 2 of 5· Check yourself
A provider shares a standard (non-secure) view that filters rows by CURRENT_ACCOUNT(). Consumers have SELECT on the view only, never on the base table. A reviewer warns that a consumer could still learn about hidden rows with a query like WHERE 1/iff(color = 'Purple', 0, 1) = 1. What should the provider do?
Granting SELECT on only the view does not protect a standard view. Its optimizations can let user code, such as a query built to raise an error, reveal hidden rows, and its definition can be read. A secure view closes both leaks. A database role only decides which objects reach the share, not which rows each account sees.
“Snowflake strongly recommends sharing secure views and/or secure UDFs instead of directly sharing tables.”Source: docs.snowflake.com
3.Reader accounts for consumers without Snowflake
A reader account lets you share with an organization that is not a Snowflake customer. You create it with CREATE MANAGED ACCOUNT, using ACCOUNTADMIN or a role granted the CREATE ACCOUNT global privilege. The consumer pays nothing to set it up or use it and signs no licensing agreement with Snowflake.
CREATE MANAGED ACCOUNT <account_name>
ADMIN_NAME = <username> , ADMIN_PASSWORD = '<password>' ,
TYPE = READER;The provider owns and manages the reader account and pays for it. Every credit its warehouses use is billed to the provider account, and there is no monthly cap. Put a resource monitor on each reader warehouse before you hand over the login. Support also runs through you: users in a reader account have no Snowflake support of their own, so you relay their issues.
A reader account is meant for querying, and the list of blocked operations reflects that. Users can create materialized views. They cannot upload or modify data, run INSERT, UPDATE, DELETE, MERGE or COPY INTO a table, create masking or row access policies, create stages or pipes, or run CREATE SHARE. That last restriction means a reader account can never pass your data on to anyone else. By default a provider can create 75 reader accounts. After you drop one, the slot stays occupied for a 7-day retention period.
Checkpoint 3 of 5· Check yourself
Your partner has no Snowflake account, so you create a reader account for them. You want them to see only the rows for their own account in a table that also holds other customers' data. Where does that row filtering have to be set up?
Reader account users cannot create masking or row access policies, and a reader account filters nothing by itself. A database role only decides which objects reach the share. The filtering has to be built into what you share: a secure view in your account that joins a mapping table on CURRENT_ACCOUNT().
“This view filters the stock data from the first table by account, using the mapping information in the second table”Source: docs.snowflake.com
Sources3
4.Configuring listings: visibility, access and auto-fulfillment
A listing wraps a share, or a Native App, in the same provider-and-consumer model as Secure Data Sharing and adds features a bare share lacks. With a listing you can publish on the Snowflake Marketplace, charge for access, attach metadata such as a title, description and sample SQL, and monitor interest in the listing and usage of the shared data. That usage monitoring gives a provider an audit view a plain share does not.
Configuring a listing starts with two choices. Visibility is either private, offered only to named accounts in any region, or public on the Snowflake Marketplace. The access option is free, limited trial or paid. Plan both before publishing, because a provider cannot later convert a listing to another type, for example from limited trial to paid.
| Access option | Where it can be offered | Best fit |
|---|---|---|
| Free | Privately or on the Snowflake Marketplace | Generic or aggregated data publicly; existing partners privately |
| Limited trial | Snowflake Marketplace | Customer-specific or licence-restricted data; trial period of 1 to 90 days, with full access granted only to consumers the provider picks |
| Paid | Privately or on the Snowflake Marketplace | Proprietary or industry-specific data, using Snowflake pricing models; offered only in specific regions |
Cross-Cloud Auto-Fulfillment is how a listing reaches consumers in other regions. Snowflake replicates the data product into a secure share area that it manages in each target region, so you do not set up replication yourself. You can enable auto-fulfillment while a listing is a draft or after it is published, but not on a trial account. Private listings cannot be replicated to other regions manually, and Snowsight turns on auto-fulfillment automatically when a target account is in another region. A private listing is fulfilled once the named consumer gets it. A public listing is fulfilled once a consumer in that region gets it. Every extra region adds cost.
auto_fulfillment:
refresh_schedule: 10 MINUTE
refresh_type: SUB_DATABASEWhen you script a listing, the manifest field rules matter.
auto_fulfillmentis required for a private listing that crosses regions and only recommended for a public one. Do not enable it when every target account is in your own region.refresh_typeis required whenever you useauto_fulfillment.SUB_DATABASEis the recommended value,SUB_DATABASE_WITH_REFERENCE_USAGEis only for application packages, andFULL_DATABASEis deprecated.refresh_scheduleaccepts a minimum of 10 minutes and a maximum of 8 days (11520 minutes), or aUSING CRONexpression.
Checkpoint 4 of 5· Match them up
Match each listing access option to the data product it fits best.
Tap a term, then the definition that fits it.
Limited trial is the option for restricted data: anyone on the Marketplace can try it, but only consumers the provider chooses get full access. Free fits generic or partner data. Paid fits proprietary data sold under Snowflake pricing models. Pick carefully, because a listing cannot be converted to another type later.
“best for providing customer-specific data, or for cases when you want to allow only certain consumers to purchase your data product”Source: docs.snowflake.com
5.Privacy policies that keep working after data is shared
A secure view controls which rows and columns a consumer can reach. It does not control what the consumer does with them. For that, a provider attaches projection, aggregation or differential privacy policies to the shared table or view. Their mechanics, including privacy budgets, are covered in Projection, aggregation and differential privacy policies with privacy budgets. The point for sharing is that these policies stay in force inside the consumer's account.
An aggregation policy shows how this works. The provider's policy administrator sets a minimum group size. Any consumer query against the protected table must then aggregate, and each group must contain at least that many records. Groups that come out too small are merged into a remainder group whose GROUP BY key is NULL. Queries cannot fall back on GROUP BY ROLLUP, CUBE or GROUPING SETS, on window functions, or on recursive CTEs to get around the policy. An aggregation policy cannot protect an external table, so keep that data in a native table, or a view over one, before sharing it.
Checkpoint 5 of 5· Check yourself
Consumers of your shared secure view see only the rows meant for their account. Compliance now wants something more: no consumer should be able to pull out individual records, only results for groups of at least 50 records. What meets this requirement?
A secure view decides which rows and columns a consumer can reach, but it does not limit what the consumer does with them. A provider-side aggregation policy stays in force inside the consumer's account, so each query must aggregate and every group must meet the minimum size. A database role only decides which objects reach the share, and enforcement cannot be left to the consumer.
“With a share or a listing, the consumer can directly query the shared data.”Source: docs.snowflake.com
Sources7
Sources
(8)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“To create a share, you must use the ACCOUNTADMIN role or a role granted the global CREATE SHARE privilege.”
↩︎ Shares and the database roles granted to them“Note that the secure view paid_sensitive_data is displayed in the command output as a table.”
↩︎ Shares and the database roles granted to them“grant database role mydb.dr1 to share mydb_shared;”
↩︎ Shares and the database roles granted to them“Only the public schema and secure object are shared.”
↩︎ Why shared objects must be secure views and secure UDFs“Set this session parameter to the name of the consumer account you wish to simulate access for.”
↩︎ Why shared objects must be secure views and secure UDFs“Snowflake strongly recommends sharing secure views and/or secure UDFs instead of directly sharing tables.”
↩︎ Key concept“Snowflake strongly recommends sharing secure views and/or secure UDFs instead of directly sharing tables.”
↩︎ Checkpoint“This view filters the stock data from the first table by account, using the mapping information in the second table”
↩︎ Checkpoint - 2.
“With secure views, the view definition and details are visible only to authorized users”
↩︎ Why shared objects must be secure views and secure UDFs“Secure views can execute more slowly than non-secure views.”
↩︎ Why shared objects must be secure views and secure UDFs“The preferred, least-privileged means of access is the SNOWFLAKE.OBJECT_VIEWER database role.”
↩︎ Why shared objects must be secure views and secure UDFs“Secure views do not utilize these optimizations, ensuring that users have no access to the underlying data.”
↩︎ Exam trap 2 - 3.
“which assumes all responsibility for credit charges incurred by users in the reader account”
↩︎ Reader accounts for consumers without Snowflake“To limit usage, set up a resource monitor for the warehouse.”
↩︎ Reader accounts for consumers without Snowflake“By default, the total number of reader accounts a provider can create is 75.”
↩︎ Reader accounts for consumers without Snowflake“a reader account can only consume data from the provider account that created it.”
↩︎ Exam trap 1“a reader account can only consume data from the provider account that created it.”
↩︎ Prediction - 4.
“A listing is an enhanced method of Secure Data Sharing and uses the same provider and consumer model.”
↩︎ Configuring listings: visibility, access and auto-fulfillment“Monitor interest in your listing and usage of the data in the share.”
↩︎ Configuring listings: visibility, access and auto-fulfillment“Providers can set the availability period for limited trial listings from 1 to 90 days.”
↩︎ Configuring listings: visibility, access and auto-fulfillment“best for providing customer-specific data, or for cases when you want to allow only certain consumers to purchase your data product”
↩︎ Checkpoint - 5.
“You can configure and enable auto-fulfillment when a listing is in either draft or published state.”
↩︎ Configuring listings: visibility, access and auto-fulfillment“You cannot manually replicate private listings to other regions.”
↩︎ Exam trap 3 - 6.https://docs.snowflake.com/en/user-guide/collaboration/listings/organizational/org-listing-manifest-referenceOfficial docs
“Required if your data product is shared through a private listing.”
↩︎ Configuring listings: visibility, access and auto-fulfillment“Minimum 10 minutes, maximum 8 days, or 11520 minutes.”
↩︎ Configuring listings: visibility, access and auto-fulfillment - 7.
“the provider can require a consumer of a table to aggregate the data rather than retrieve individual records.”
↩︎ Privacy policies that keep working after data is shared“You cannot protect an external table with an aggregation policy.”
↩︎ Privacy policies that keep working after data is shared
Also cited
“With a share or a listing, the consumer can directly query the shared data.”
↩︎ Checkpoint