skip to content

In Snowflake, what does a secure data share give a consumer account, and what gets copied?

level: middleimportance: must knowfreq 65%

answer

  1. no export job, no nightly file drop
  2. the provider keeps the only physical copy
  3. consumer brings the warehouse, provider the storage
  4. a metadata grant, not a data transfer
  5. committed writes are visible with no refresh

basics

~20 s

A Snowflake share is a metadata object that grants another account read-only access to specific tables and secure views. No data is copied: the consumer queries the provider's storage directly, paying only for their own compute.

solid answer

~50 s

A share is a named object in the provider's account that holds a set of grants (usage on a database and schema, select on tables, external tables, secure views, secure materialized views, secure UDFs) plus the list of consumer accounts allowed to import it. The consumer runs `CREATE DATABASE <name> FROM SHARE <provider_account>.<share_name>` and gets a read-only database. Because Snowflake separates storage from compute, the share is just metadata pointing at the provider's existing micro-partitions — nothing is duplicated, so a committed change on the provider side is visible to the consumer immediately with no pipeline, no export and no refresh. Billing splits cleanly: the provider pays storage for the single copy, the consumer pays for the virtual warehouse that runs their queries. The shared database is strictly read-only — no DML, no DDL, no cloning, and the consumer cannot re-share it onward.

code

sql · 6 lines
sql
-- Provider account
CREATE SHARE sales_share;
GRANT USAGE ON DATABASE analytics TO SHARE sales_share;
GRANT USAGE ON SCHEMA analytics.public TO SHARE sales_share;
GRANT SELECT ON TABLE analytics.public.orders TO SHARE sales_share;
ALTER SHARE sales_share ADD ACCOUNTS = myorg.partner_acct;

go deeper

for a junior

Recall the shape: a provider creates a share, a consumer creates a database from it, and the data is never copied. Knowing that the consumer's queries run on the consumer's own warehouse already puts you ahead.

for a middle

Be ready to write both sides of the DDL and to explain the grant chain, including that imported privileges must be re-granted in the consumer account. Explain why zero copying makes the data live rather than nightly.

for a senior

Expect to contrast sharing with an export pipeline on freshness, egress cost, revocability and audit surface, and to name the real constraints — same-region only for a direct share, secure views only, read-only with no cloning or re-sharing.

for a principal

Own the commercial and governance model: storage stays on one bill while query cost lands on each consumer, access is revocable in a statement, and the objects you grant define the contract. Decide when a share is a product surface rather than an integration detail.

## What a share actually is A share is a named account-level object in the **provider's** Snowflake account. It lives in the cloud services (metadata) layer and contains exactly two things: a collection of grants on objects, and a list of consumer accounts entitled to import it. It contains no rows. Nothing about it resembles an export, a replication job or a copy. The object types you can put in a share are limited: databases and schemas (usage), tables, external tables, secure views, secure materialized views and secure UDFs. Notably a *standard* view cannot be added to a share — it must be declared `SECURE`, because a share hands query access to a party outside your account and Snowflake will not expose a view whose definition and optimizer behaviour could leak the underlying data. ## Setting one up On the provider side, the grant chain must be complete from the database down: ```sql CREATE SHARE sales_share; GRANT USAGE ON DATABASE analytics TO SHARE sales_share; GRANT USAGE ON SCHEMA analytics.public TO SHARE sales_share; GRANT SELECT ON TABLE analytics.public.orders TO SHARE sales_share; ALTER SHARE sales_share ADD ACCOUNTS = myorg.partner_acct; ``` A missing `USAGE` on the schema is the single most common reason a consumer sees an empty database. On the consumer side: ```sql CREATE DATABASE partner_sales FROM SHARE provider_org.provider_acct.sales_share; GRANT IMPORTED PRIVILEGES ON DATABASE partner_sales TO ROLE analyst; ``` The second statement matters and is often forgotten: privileges arriving through a share are *imported* privileges, and the consumer's ACCOUNTADMIN must pass them to the roles that will actually query. ## Why nothing is copied Snowflake stores table data as immutable compressed columnar micro-partitions in cloud object storage owned by the provider's account, with all metadata held centrally. A share adds an entry to that metadata saying "account X may read these objects". When the consumer's warehouse executes a query, it reads the provider's micro-partition files directly. There is no second copy to fall behind, so freshness is a non-issue: as soon as a provider transaction commits, the consumer's next query sees it. This is also why the consumer's shared database contributes nothing to their storage bill — they own no bytes. ## Who pays for what - **Provider**: storage for the one physical copy of the data. Nothing for the consumer's queries. - **Consumer**: compute. They run queries on their own virtual warehouse, in their own account, on their own credits. This split is what makes sharing attractive commercially — a provider can serve many consumers without their query load touching the provider's warehouses or bill. It also means a consumer's runaway dashboard cannot degrade the provider, since the compute clusters are entirely separate. ## What the consumer cannot do The imported database is read-only in a strong sense: - no `INSERT`/`UPDATE`/`DELETE`, and no DDL inside it; - it cannot be cloned; - it cannot be re-shared onward to a third account; - Time Travel over the shared objects is not available to the consumer. If the consumer needs a mutable or historical copy, they do the obvious thing: `CREATE TABLE my_copy AS SELECT ... FROM partner_sales...`, which is their own data on their own storage bill, and which immediately reintroduces every staleness problem sharing was meant to remove. ## Where it fits in an interview The scenario that pulls this out is "a partner or a subsidiary needs our data". The weak answer is a nightly `COPY INTO` to S3 plus a loader on their side — a pipeline to build, monitor, secure and pay egress on, delivering yesterday's data. The strong answer is a share: no movement, no lag, revocable in one statement (`ALTER SHARE ... REMOVE ACCOUNTS`), and the access surface is exactly the objects you granted rather than a bucket somebody may have made world-readable. The constraints worth naming unprompted are that both accounts must be in the same cloud region for a direct share (otherwise replication or a listing is required), and that only secure views can carry any row- or column-level restriction you want to impose.

  • The consumer created the database from the share, but their analyst role sees no tables. What did you miss?
    Two likely causes. On the provider side, the grant chain may be incomplete — `USAGE` on the database *and* the schema is required in addition to `SELECT` on the objects. On the consumer side, privileges arriving through a share are imported privileges, so ACCOUNTADMIN must run `GRANT IMPORTED PRIVILEGES ON DATABASE <db> TO ROLE analyst` before any non-admin role can query it.
  • How does the provider revoke access, and how quickly does it take effect?
    `ALTER SHARE <name> REMOVE ACCOUNTS = <account>`, or drop the share entirely. Because access is purely a metadata grant with no copy on the consumer side, revocation is effectively immediate — the consumer's database stops resolving. That instant, complete revocation is one of the main governance arguments for sharing over shipping files, where every delivered file stays delivered.
  • Can the consumer join shared data to their own tables?
    Yes, and that is the usual point of it. The shared database behaves like any other database for reads, so a consumer can join the provider's fact table to their own dimensions in a single query on their own warehouse. Only writes into the shared database are blocked; nothing prevents them from creating their own tables that read from it.

It is closer to giving someone a library card than to photocopying the book: they read your shelf with their own eyes and their own time, and when you replace a page everyone sees the new one.

saying these in an interview costs you the question

  • Says the share replicates the data into the consumer's account nightly
  • Thinks the consumer is billed for the shared data's storage
  • Claims the consumer can INSERT into or clone the shared database
  • Assumes a plain non-secure view can be added to a share
  • Believes the consumer must refresh before seeing provider changes

context