One of Snowflake’s most popular features is its data sharing capability, which allows organizations to securely share data with external partners, customers, or other departments within the same company.
Snowflake’s data sharing feature enables users to easily share any number of tables, views, and databases across accounts without having to physically move the data or create complex data pipelines. This is a major advantage for businesses that need to collaborate with other organizations or departments, as it eliminates the need for expensive data integration solutions or complex data sharing arrangements.
To use the data sharing feature in Snowflake, users must first create a sharing relationship between their accounts. This can be done through the Snowflake console or via the SnowSQL command line tool. Once the sharing relationship is established, users can choose which tables, views, or databases they want to share and with whom.
For example, let’s say a company named Freshers Inc. has a database named freshers_db and a table named freshers_tbl containing information about their employees. They want to share this information with a partner company named Partner Inc. To do this, Freshers Inc. would first create a sharing relationship with Partner Inc.’s Snowflake account. Then, they would grant Partner Inc. the appropriate privileges to access the freshers_db database and the freshers_tbl table.
Partner Inc. can then access the shared data by connecting to their own Snowflake account and querying the data as if it were their own. They can also join the shared data with their own data, creating a unified view that combines information from both companies.
One of the biggest advantages of Snowflake’s data sharing feature is its security. Snowflake uses advanced encryption and access control mechanisms to ensure that only authorized users can access the shared data. This makes it easy for companies to collaborate and share data without compromising the security of their information.
In addition to its security features, Snowflake’s data sharing feature also provides businesses with increased agility and flexibility. By enabling real-time access to data across multiple organizations, Snowflake allows businesses to make faster and more informed decisions based on the most up-to-date information available.
Snowflake’s data sharing feature is a powerful tool that enables businesses to securely share data with external partners and internal departments. Its security, agility, and flexibility make it an ideal solution for businesses looking to collaborate and share data without compromising the security or integrity of their information.
Performing data sharing in Snowflake requires the following steps:
- Establish a sharing relationship: To share data, you need to establish a sharing relationship with the account that you want to share data with. This can be done through the Snowflake console or via SnowSQL command line tool.
- Grant privileges: Once the sharing relationship is established, grant the necessary privileges to the objects (tables, views, and databases) you want to share with the other account.
- Share objects: Share the objects with the other account by creating a share, and then granting access to the share.
- Access shared data: Once the objects are shared, the other account can access the shared data by creating a database in their account that references the share, and then querying the data.
Let’s go through these steps in more detail:
- Establish a sharing relationship: To establish a sharing relationship, you need to know the account ID and region of the account that you want to share data with. This information can be obtained from the account’s Snowflake console.
Once you have this information, you can create an external account object in your account that references the other account’s credentials. This is done using the CREATE EXTERNAL ACCOUNT command.
- Grant privileges: After establishing the sharing relationship, you need to grant the necessary privileges to the objects that you want to share with the other account. This is done using the GRANT command.
For example, to grant SELECT privilege on a table named “my_table” to the other account, you can use the following command:
GRANT SELECT ON TABLE my_table TO ACCOUNT other_account;
- Share objects: Once the necessary privileges are granted, you can share the objects with the other account. This is done by creating a share, which is a named container for the shared objects.
For example, to create a share named “my_share” that includes the “my_table” table, you can use the following command:
CREATE SHARE my_share;
GRANT USAGE ON SHARE my_share TO ACCOUNT other_account;
ALTER TABLE my_table SET SHARE=my_share;
- Access shared data: Finally, the other account can access the shared data by creating a database that references the share, and then querying the data.
For example, to create a database named “my_db” in the other account that references the “my_share” share, you can use the following command:
CREATE DATABASE my_db FROM SHARE my_share;
Once the database is created, the other account can query the shared data as if it were local to their account. In summary, performing data sharing in Snowflake requires establishing a sharing relationship, granting privileges, sharing objects, and accessing shared data. These steps can be performed through the Snowflake console or via the SnowSQL command line tool.
Snowflake important urls to refer