π Data Sharing in Snowflake:
β What is Data Sharing in Snowflake?β
Data Sharing in Snowflake allows you to share live, read-only access to selected datasets without copying or duplicating the data. This means consumers can query your data directly in their Snowflake environment (or via a reader account), in real time, while you maintain full control.
β Types of Data Sharingβ
| Type | Description |
|---|---|
| Direct Sharing | Share data with another Snowflake account in the same region. |
| Reader Accounts | Share with consumers who do not have a Snowflake account. |
| Cross-Region Sharing | Share data across regions within the same cloud provider. |
| Cross-Cloud Sharing | Share data across different cloud platforms (e.g., AWS to Azure). |
| Listing (Marketplace) | Publicly share data or monetize it via the Snowflake Marketplace. |
π Why Use Data Sharing?β
βοΈ Collaborate easily with partners, vendors, or other departments. βοΈ Save on storage and ETL costs. βοΈ Share data instantly without complex pipelines. βοΈ Cross-cloud, cross-region supported via Snowgrid.
π What Objects Can Be Shared?β
You can share read-only access to the following:
| Object Type | Can Share? | Notes |
|---|---|---|
| Databases | β | Consumers create databases from shares. |
| Schemas | β | Consumers can query shared schemas. |
| Tables | β | Read-only access to tables. |
| Secure Views | β | Only secure views are shareable (not standard views). |
| Secure UDFs/Functions | β | Only secure UDFs can be shared. |
| External Tables | β | Cannot be shared. |
| Stages | β | External/internal stages are not shareable. |
| File Formats | β | File formats not shareable directly. |
| Tasks, Streams | β | These are not shareable. |
β How Data Sharing Works in Snowflakeβ
Data sharing is based on metadata pointers, not data copies.
π§ Implementation Flow:β
-
Create a Share
CREATE SHARE healthcare_share; -
Add Objects to Share
GRANT USAGE ON DATABASE healthcare TO SHARE healthcare_share;
GRANT SELECT ON ALL TABLES IN SCHEMA healthcare.patients TO SHARE healthcare_share; -
Grant Access to Consumer Account
ALTER SHARE healthcare_share ADD ACCOUNTS = ('account_locator'); -
(Optional) Create Reader Account
CREATE MANAGED ACCOUNT reader_acct ...; -
Consumer Mounts the Share
CREATE DATABASE shared_data FROM SHARE provider_org.healthcare_share;
β Components of a Shareβ
| Component | Description |
|---|---|
| Share | A container holding database objects (tables, views, schemas). |
| Provider | The Snowflake account that creates and shares the data. |
| Consumer | The Snowflake account (or reader account) accessing the data. |
| Reader Account | A Snowflake-managed account created by the provider for consumers. |
β Advantages of Data Sharingβ
| Benefit | Description |
|---|---|
| No Data Movement | Avoids ETL processes and storage duplication. |
| Live Access | Consumers access always-updated data. |
| Cost-Efficient | Consumers pay for their compute; providers incur no compute cost. |
| Governed Access | Fine-grained permissions and RBAC can be enforced on shared objects. |
| Secure & Auditable | Encryption, access logs, masking, and row-level security apply. |
| High Performance | Uses Snowflakeβs compute and storage layers directly, no external transfer. |
β Real-World Use Casesβ
- Healthcare: Hospitals share anonymized datasets with research partners securely.
- Finance: Market data providers publish live stock feeds to brokers.
- Retail: Vendors access real-time sales and inventory data from retailers.
- Government: Agencies collaborate on census or policy data without duplication.
β Roles & Privileges in Data Sharingβ
| Role | Purpose |
|---|---|
| ACCOUNTADMIN | Full access to manage shares and reader accounts. |
| SECURITYADMIN | Manages privileges and role assignments. |
| Custom Role | Can be granted share privileges with IMPORTED PRIVILEGES. |
Key Privileges:β
| Privilege | Description |
|---|---|
USAGE | Grants ability to use a database or schema. |
SELECT | Grants read access to tables and views. |
IMPORTED PRIVILEGES | Allows querying shared data from the consumer side. |
π¦ Limitations and Important Notesβ
β Read-only for Consumers
- Consumers cannot modify shared data (no
INSERT,UPDATE,DELETE).
β No Direct File/Stage Sharing
- Stages, file formats, and external tables arenβt shareable.
β Secure Objects Only
- Only secure views/UDFs can be shared.
β Data Location
- Data physically stays in the providerβs Snowflake region.
- Consumers in other regions still query live data, but cross-cloud/region latency might impact performance.
β Security & Governance for Data Sharingβ
Snowflake ensures secure sharing through:
- End-to-End Encryption (TLS in transit, AES-256 at rest)
- Access Control via RBAC
- Dynamic Data Masking on shared views
- Row-Level Security for personalized data sharing
- Access History Logs for monitoring and auditing
- Object Tagging and Data Classification
π On-Premises Integrationβ
πΉ No direct sharing to on-prem databases (e.g., Oracle, SQL Server). πΉ On-premises users query shared data via a Snowflake consumer account using ODBC/JDBC/BI tools.
β Best Practices for Data Sharingβ
| Best Practice | Why It Matters |
|---|---|
| Use Secure Views | Avoid exposing raw data; mask or filter sensitive columns. |
| Audit Usage Regularly | Monitor how shared data is being used or accessed. |
| Limit Object Exposure | Share only necessary schemas/tables/views. |
| Use Tags for Governance | Helps track sensitive/shared data assets. |
| Separate Share-Ready Schemas | Keep shared objects isolated from raw/production schemas. |
| Create Reader Accounts for Simplicity | Especially useful for clients without Snowflake licenses. |
Difference Between Views and Shares in Snowflakeβ
| Aspect | Views | Shares |
|---|---|---|
| Definition | A view is a virtual table defined by a SQL query that runs on-demand when accessed. It does not store data physically but presents data from underlying tables or other views. | A share is a Snowflake object that enables secure, controlled sharing of database objects (tables, views, schemas) between Snowflake accounts without copying the data. |
| Purpose | Used to simplify complex queries, abstract data, filter or transform data, and enforce security policies (e.g., hide sensitive columns via secure views). | Used to share data securely with other Snowflake accounts or Reader Accounts, allowing those consumers to query live data without data duplication. |
| Storage | Views do not store data; results are generated in real-time when queried (except materialized views which precompute and store). | Shares do not store data independently; they provide access pointers to existing database objects owned by the provider account. |
| Security & Control | With secure views, the view definition is hidden and sensitive data can be masked or restricted. They protect data visibility while controlling access. | Shares enforce read-only access to data and prevent consumers from modifying or re-sharing data. Providers control what and who shares data with, including revoking access. |
| Scope | Views exist within a database and schema and serve as query abstractions or security layers on data in that environment. | Shares operate at the database/schema level to expose multiple objects to external accounts, enabling cross-account data collaboration. |
| Use in Sharing | Views (especially secure views) are often included inside shares to expose a controlled subset of data safely. | Shares are the vehicle to deliver access to data objects (tables, views) from provider to consumer accounts. |
Additional Notes on Views:β
- Regular (non-materialized) views run the underlying query each time they are accessed, offering real-time data but with some performance cost.
- Materialized views store precomputed results for faster query responses but consume storage and maintenance resources.
- Secure views add privacy by hiding the logic and applying masking or row-level security.
Summaryβ
- Views are query-defined virtual tables used to abstract, filter, or secure data within a database.
- Shares are data-sharing objects enabling controlled external access to databases and objects (including views) across Snowflake accounts, without moving or copying data physically.
β Summaryβ
| Topic | Summary |
|---|---|
| What | Share live, read-only data without copies |
| How | Create share β add objects β grant access β consumer mounts share |
| Why | Cost savings, performance, real-time access, governance |
| Security | RBAC, encryption, masking, audit logs |
| Compliance | Supports HIPAA, GDPR, SOC 2, and more |
| Users | Both Snowflake and non-Snowflake consumers via Reader Accounts |
β Snowflakeβs Data Sharing model transforms how businesses collaborate β removing friction, reducing cost, and improving agility without sacrificing control or security.