0
0
Snowflakecloud~5 mins

Why data sharing eliminates data copies in Snowflake - Why It Works

Choose your learning style9 modes available
Introduction
Data sharing lets you access data directly from another account without making extra copies. This saves storage space and keeps data up to date automatically.
When you want to give a partner access to your data without sending files.
When multiple teams need to use the same data without duplicating it.
When you want to avoid delays caused by copying large datasets.
When you want to keep data consistent and avoid version conflicts.
When you want to reduce storage costs by not duplicating data.
Commands
This command creates a new data share named 'my_share' to share data with other accounts.
Terminal
CREATE SHARE my_share;
Expected OutputExpected
Statement executed successfully.
This grants the share access to the database 'my_database' so the data can be shared.
Terminal
GRANT USAGE ON DATABASE my_database TO SHARE my_share;
Expected OutputExpected
Statement executed successfully.
This adds a specific schema from the database to the share, specifying which data is shared.
Terminal
ALTER SHARE my_share ADD SCHEMA my_schema;
Expected OutputExpected
Statement executed successfully.
In the consumer account, this command creates a database that references the shared data without copying it.
Terminal
CREATE DATABASE shared_db FROM SHARE provider_account.my_share;
Expected OutputExpected
Statement executed successfully.
This lists the tables available in the shared database to verify access to the shared data.
Terminal
SHOW TABLES IN DATABASE shared_db;
Expected OutputExpected
name kind database schema comment shared_table TABLE shared_db my_schema
Key Concept

Data sharing lets multiple users access the same data directly without making extra copies, saving space and keeping data fresh.

Common Mistakes
Trying to copy shared data into a new table manually.
This defeats the purpose of sharing by creating duplicates and wasting storage.
Use the shared database directly without copying data.
Not granting usage on the database or schema to the share.
Without proper grants, the share cannot access the data, so sharing fails.
Always grant usage on the database and schema to the share.
Assuming shared data is stored in the consumer account.
Shared data stays in the provider account; consumer only references it.
Understand that sharing creates a live reference, not a copy.
Summary
Create a share and grant it access to the database and schema you want to share.
Consumers create a database from the share to access data without copying it.
This method saves storage and keeps data consistent across accounts.