What you will be able to do
- Import a share with CREATE DATABASE FROM SHARE and give local roles access to it
- Decide when a consumer needs a reader account and when it needs its own database or storage
- Create, configure, monitor and drop reader accounts with CREATE MANAGED ACCOUNT
- Install the Data Clean Rooms native app, bring users in and manage collaborators
1.Importing an inbound share
An inbound share is a share another account has made available to yours. It does nothing until you create a database from it. That database is read-only and holds no data of its own: the rows stay in the provider's account, and your account pays only for the warehouse compute used to query them. Each share can be turned into exactly one database, but you can import as many different shares as you like, from as many providers as you like.
create database mydb_shared1 from share <provider_account>.mydb_shared;How you open the imported database to other roles depends on how the provider built the share. If the provider granted objects through database roles, you grant one of those database roles to a local role, and that role sees only that role's subset. If the provider granted objects directly to the share, you grant IMPORTED PRIVILEGES on the whole imported database. From then on, normal role-based access control applies. SHOW SHARES and DESC SHARE let you inspect an inbound share before importing it.
/* Option 1 */ grant database role mydb_shared1.db1 to role custom_role1; /* Option 2 */ grant imported privileges on database mydb_shared1 to custom_role1;Whether you need your own storage depends on what you do next. Querying an imported database uses no storage at all. Anything you write, such as tables built from the shared rows or your own streams on shared tables, has to live in a database you create yourself, because the imported one cannot be changed. New rows from the provider appear right away; a new provider object appears only once the provider grants it to the share.
Checkpoint 1 of 4· Check yourself
A consumer account has an inbound share from a provider. The finance and marketing teams each want their own access to the shared data. What should the consumer's administrator do?
Each share can become only one database in the consumer account. Teams are separated with normal role-based access control on that one database: either by granting a shared database role to a local role, or by granting IMPORTED PRIVILEGES. The provider controls only what goes into the share. It cannot grant to the consumer's roles.
“You can consume as many shares as you want from data providers, but you can only create one database per share.”Source: docs.snowflake.com
Sources1
2.Reader accounts for consumers without Snowflake
Data sharing only works between Snowflake accounts, so a consumer with no account gets a reader account, previously called a read-only account. The provider creates, owns and manages it, and pays for every credit its users consume. The consumer signs no contract with Snowflake and pays nothing. Two constraints follow from that ownership: a reader account can consume data only from the provider that created it, and its users get support from the provider, not from Snowflake.
Reader accounts are created with SQL or in Snowsight under Admin » Accounts » Reader accounts. Either way you need ACCOUNTADMIN or a role holding the CREATE ACCOUNT global privilege, which ACCOUNTADMIN can grant to a role such as SYSADMIN to delegate the work. The object behind it is a MANAGED ACCOUNT, and the command returns the account name, locator and login URL. The new account gets the provider's Snowflake edition and the provider's region. A Business Critical provider therefore gets a Business Critical reader, and a consumer in another region cannot be served this way.
USE ROLE ACCOUNTADMIN;
CREATE MANAGED ACCOUNT <account_name>
ADMIN_NAME = <username> , ADMIN_PASSWORD = '<password>' ,
TYPE = READER;Wait up to five minutes for provisioning, then do two things before anyone can use the account. First, add it to one or more shares from the provider side. Second, configure it: log in as the ADMIN_NAME user and create the users, the custom roles, the warehouse they will query with, and the database from the share, with grants on it to those roles. The cost control belongs on the provider's desk as well.
The provider therefore puts a resource monitor on each reader account warehouse. The mechanics are in Resource monitors. Here the motive is simply that the provider pays for compute in an account it doesn't use. The READER_ACCOUNT_USAGE schema in the SNOWFLAKE database reports on all your reader accounts, and SHOW MANAGED ACCOUNTS counts them against the default limit of 75.
| Allowed | Blocked |
|---|---|
| Query shared data | INSERT, UPDATE, DELETE, MERGE, COPY INTO <table> |
| Create materialized views over shared data | CREATE SHARE, CREATE STAGE, CREATE PIPE |
| Create users, roles and warehouses | CREATE MASKING POLICY, CREATE ROW ACCESS POLICY |
| COPY INTO <location> with your own credentials | Unloading through a storage integration; refreshing dynamic tables |
Dropping a reader account is final. DROP MANAGED ACCOUNT removes every object in it, cuts off access immediately, and cannot be undone. Dropping one to make room under the limit does not free the slot right away either: a new reader account can't be created for 7 days, the retention period for deleted reader accounts. For regional outages, Client Redirect can switch reader users between two reader accounts in different regions.
Checkpoint 2 of 4· Fill the gap
A provider is creating a reader account for a consumer who has no Snowflake account. Which keyword completes this command?
USE ROLE ACCOUNTADMIN;
CREATE ? ACCOUNT <account_name>
ADMIN_NAME = <username> , ADMIN_PASSWORD = '<password>' ,
TYPE = READER;The object behind a reader account is a MANAGED ACCOUNT, created with CREATE MANAGED ACCOUNT ... TYPE = READER. The same object is listed with SHOW MANAGED ACCOUNTS and removed with DROP MANAGED ACCOUNT.
Source: docs.snowflake.comCheckpoint 3 of 4· Check yourself
Your company runs a Business Critical Snowflake account in AWS us-east-1. A partner in Europe has no Snowflake account and wants to query your data. You decide to create a reader account for them. Which statement about that reader account is correct?
A reader account always gets the provider's edition and the provider's region, so it cannot serve as a way to reach another region. Because the provider owns it, it can only consume data from the provider that created it.
“The reader account utilizes the same Snowflake Edition as the provider account and is created in the same region.”Source: docs.snowflake.com
Sources2
3.Snowflake Data Clean Rooms
A clean room is the sharing option for partners who must analyse data together without handing over raw rows: the data owner controls which queries can run against its data. Setting one up starts with installing a native application. Each participating account installs SAMOOHA_BY_SNOWFLAKE, a bootstrapper app from the Snowflake Data Clean Rooms Marketplace listing. It provides the library procedures, delegation roles and helper functions the clean room environment runs on. Each collaboration an account joins then installs its own application, which exposes secure views filtered to that account.
Bringing people in is gated at the user level. Each user who will review or join a collaboration must have a first and last name and a validated email address on their Snowflake user profile. In a collaboration, each collaborator creates data offerings, and the collaboration definition decides who can use which data, through which templates, and whether free-form SQL is allowed.
Collaborators are managed by procedure calls, not GRANT statements. In the provider/consumer API, the provider adds consumer accounts to a clean room, publishes it, and the consumer installs it by calling consumer.install_cleanroom. Collaborators in different cloud regions rely on Cross-Cloud Auto-Fulfillment. Only those who share or activate data must enable it, every collaborator needs a distinct account locator, and cross-region data arrives with replication lag.
CALL SAMOOHA_BY_SNOWFLAKE_LOCAL_DB.provider.add_consumers( $cleanroom_name, $consumer_locator, $consumer_account_name);Checkpoint 4 of 4· Check yourself
Two retailers want to measure how many customers they have in common. Each one must decide exactly which queries the other can run against its customer data, and neither may see the other's raw rows. Which sharing option fits?
A secure view, a listing or a reader account hides internals or limits rows, but the consumer can still run any query on whatever rows it receives. Only a clean room lets the data owner control which queries can be run, so partners can analyse together without handing over raw rows.
“a clean room, in which you can share data and control which queries can be run against your data.”Source: docs.snowflake.com
Sources
(5)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“A data consumer is any account that chooses to create a database from a share made available by a data provider.”
↩︎ Importing an inbound share“The only charges to consumers are for the compute resources (i.e. virtual warehouses) used to query the imported data.”
↩︎ Importing an inbound share“All database objects shared between accounts are read-only”
↩︎ Importing an inbound share“you can only create one database per share.”
↩︎ Exam trap 2“You can consume as many shares as you want from data providers, but you can only create one database per share.”
↩︎ Checkpoint“a clean room, in which you can share data and control which queries can be run against your data.”
↩︎ Checkpoint - 2.
“a reader account can only consume data from the provider account that created it.”
↩︎ Reader accounts for consumers without Snowflake“To limit usage, set up a resource monitor for the warehouse.”
↩︎ Reader accounts for consumers without Snowflake“wait for up to five minutes to ensure that the account is fully provisioned.”
↩︎ 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“This operation can not be undone.”
↩︎ Reader accounts for consumers without Snowflake“The reader account utilizes the same Snowflake Edition as the provider account and is created in the same region.”
↩︎ Exam trap 1“Warehouses in a reader account can consume an unlimited number of credits each month, which will be charged to your provider account.”
↩︎ Prediction“The reader account utilizes the same Snowflake Edition as the provider account and is created in the same region.”
↩︎ Checkpoint - 3.
“Each account has this bootstrapper application installed from the Snowflake Data Clean Rooms Marketplace listing.”
↩︎ Snowflake Data Clean Rooms - 4.
“must have a first and last name set with a validated email address on their Snowflake user profile”
↩︎ Snowflake Data Clean Rooms“Every collaborator must have a different account locator.”
↩︎ Snowflake Data Clean Rooms“Only collaborators sharing or activating data must enable this on their account.”
↩︎ Snowflake Data Clean Rooms - 5.
“The consumer installs the clean room by calling consumer.install_cleanroom.”
↩︎ Snowflake Data Clean Rooms