> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sonarx.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How To Access And Query Snowflake Data Shares

> For users with a Snowflake Full Account (Customers with a Reader account do not need it)

### HOW TO GET STARTED WITH SNOWFLAKE

1. Go to Data Products -> Private Sharing -> Shared With You
2. Click on one of the shares. I will be using the "Sonarverse Stacks Trial Share" as an example.
3. Click "Get"

<img src="https://mintcdn.com/sonarx-7d42dde1/LaLAWfb2rYfbMHD1/datashares/images/Snowflakedatasharesetup1.png?fit=max&auto=format&n=LaLAWfb2rYfbMHD1&q=85&s=ec9f743511a89ebc7decf115bb846f7a" alt="Snowflakedatasharesetup1 Pn" width="2274" height="1384" data-path="datashares/images/Snowflakedatasharesetup1.png" />

4. Denote the database name and which roles can access that share. E.g. if you grant the RESEARCH\_ANALYST\_ROLE permission to access this database, any user with the RESEARCH\_ANALYST\_ROLE can access the database.

<img src="https://mintcdn.com/sonarx-7d42dde1/LaLAWfb2rYfbMHD1/datashares/images/Snowflakedatasharesetup2.png?fit=max&auto=format&n=LaLAWfb2rYfbMHD1&q=85&s=c3e7b0926567a47c26b24c53f3a9b5ce" alt="Snowflakedatasharesetup2 Pn" width="1974" height="1362" data-path="datashares/images/Snowflakedatasharesetup2.png" />

5. Repeat steps 1-4 for the any other provisioned shares.
6. Open a worksheet and run the query "show databases;" to view the databases that are automatically created from these shares. From there you can create your own tables from the databases.

### HOW TO PROVISION A NEW USER IN SNOWFLAKE

Customers should share the same Snowflake Account. That way they can share the same infrastructure and consolidated billing, if need be.

You can do so by CREATE USER command or via the UI from:

* Admin -> Users & Roles

<img src="https://mintcdn.com/sonarx-7d42dde1/LaLAWfb2rYfbMHD1/datashares/images/Snowflakedatasharesetup3.png?fit=max&auto=format&n=LaLAWfb2rYfbMHD1&q=85&s=efbc9224ff2677b1a94615386abfc3ea" alt="Snowflakedatasharesetup3 Pn" width="718" height="133" data-path="datashares/images/Snowflakedatasharesetup3.png" />

### HOW TO GRANT ACCESS/PRIVILEGES FOR SNOWFLAKE USERS

Here is a series of useful scripts to help you get started on Snowflake.

1. Creates a READER\_ROLE to access Snowflake data
2. Creates a READ\_WH to run compute on Snowflake
3. Grants permission on READ\_WH to the new READER\_ROLE
4. Grants IMPORTED PRIVILEGES on data shares to READER\_ROLE
5. Grants READER\_ROLE to Users

```
use role accountadmin;

-- Create Reader Role 
create role reader_role; 
grant role reader_role to role sysadmin;

-- Create Warehouse for Compute 
create warehouse read_wh 
with warehouse_size = 'X-SMALL' 
auto_suspend = 60 
auto_resume = true;

-- Grant Permission on Warehouse 
grant usage, operate, monitor, modify 
on warehouse read_wh to role reader_role;

-- Grant Data Share to Role 
grant imported privileges on database sonarverse_solana_trial_share to role reader_role; 
grant imported privileges on database sonarverse_solana_raw_trial_share to role reader_role; 
grant imported privileges on database sonarverse_xrp_trial_share to role reader_role; 
grant imported privileges on database sonarverse_xrp_raw_trial_share to role reader_role;

-- Grant Reader Role to User: change to your usernames 
grant role reader_role to user x; 
grant role reader_role to user y;
```

Once this is done, you can now switch to READER\_ROLE and you’ll see the data shares to query. Be sure to set your Role, Warehouse, and Database/Schema context on a Worksheet to run your queries in Snowflake.

<img src="https://mintcdn.com/sonarx-7d42dde1/LaLAWfb2rYfbMHD1/datashares/images/Snowflakedatasharesetup4.png?fit=max&auto=format&n=LaLAWfb2rYfbMHD1&q=85&s=c0f58c8c412d695f2f94778a05081881" alt="Snowflakedatasharesetup4 Pn" width="720" height="545" data-path="datashares/images/Snowflakedatasharesetup4.png" />

<img src="https://mintcdn.com/sonarx-7d42dde1/LaLAWfb2rYfbMHD1/datashares/images/Snowflakedatasharesetup5.png?fit=max&auto=format&n=LaLAWfb2rYfbMHD1&q=85&s=234f3ee0f99d1ae587eee9d18b6ca70e" alt="Snowflakedatasharesetup5 Pn" width="720" height="460" data-path="datashares/images/Snowflakedatasharesetup5.png" />

### HOW TO VIEW DATA DICTIONARY AND SAMPLE QUERIES IN SNOWFLAKE

Please note the following steps to view the Data Dictionary of a Data Share:

1. Go to Snowflake -> Private Sharing -> Shared With You
2. Click on the listing (using Sonarverse Cosmos Trial Share as an example)

<img src="https://mintcdn.com/sonarx-7d42dde1/LaLAWfb2rYfbMHD1/datashares/images/Snowflakedatasharesetup6.png?fit=max&auto=format&n=LaLAWfb2rYfbMHD1&q=85&s=cb9b534749c1d21e459c9bbf53ead385" alt="Snowflakedatasharesetup6 Pn" width="1216" height="361" data-path="datashares/images/Snowflakedatasharesetup6.png" />

3. You will be able to view the Data Dictionary of that share, where you can see all the table and column definitions directly in Snowflake.

<img src="https://mintcdn.com/sonarx-7d42dde1/LaLAWfb2rYfbMHD1/datashares/images/Snowflakedatasharesetup7.png?fit=max&auto=format&n=LaLAWfb2rYfbMHD1&q=85&s=1574a514374bed2b55039a7e6aa12be9" alt="Snowflakedatasharesetup7 Pn" width="1181" height="1032" data-path="datashares/images/Snowflakedatasharesetup7.png" />

4. Scroll further down to see sample queries

<img src="https://mintcdn.com/sonarx-7d42dde1/LaLAWfb2rYfbMHD1/datashares/images/Snowflakedatasharesetup8.png?fit=max&auto=format&n=LaLAWfb2rYfbMHD1&q=85&s=0f891d1673ed16792b529cf5ea097a6b" alt="Snowflakedatasharesetup8 Pn" width="866" height="851" data-path="datashares/images/Snowflakedatasharesetup8.png" />
