# Giving access to Snowflake data

By default, the Whaly platform only has access to data that was imported using Whaly connectors.

If you have data already stored inside your Snowflake account that you want to access within Whaly BI, you can do it using the following commands:

{% hint style="info" %}
Please run those commands with the `ACCOUNTADMIN` role to have the proper sharing rights!
{% endhint %}

### 1. Give access to Whaly BI to a Snowflake database

```
set whaly_bi_role = 'WHALY_BI_ROLE';
set snowflake_database = 'INSERT_PROPER_DATABASE_NAME_TO_EXPOSE_IN_WHALY_BI';

grant USAGE
    on database identifier($snowflake_database)
    to role identifier($whaly_bi_role);
```

This will get Whaly access to the database but not to the data stored inside it. Follow the next steps to give access to the proper part of the database to Whaly ⤵️

### 2. Wide access | Give access to Whaly BI to ALL Schemas and ALL Tables located in a Snowflake database

```
set whaly_bi_role = 'WHALY_BI_ROLE';
set snowflake_database = 'INSERT_PROPER_DATABASE_NAME_TO_EXPOSE_IN_WHALY_BI';

USE DATABASE identifier($snowflake_database);
grant USAGE
    on all schemas in database identifier($snowflake_database)
    to role identifier($whaly_bi_role);
grant SELECT 
    on all tables in database identifier($snowflake_database)
    to role identifier($whaly_bi_role);
grant SELECT 
    on future tables in database identifier($snowflake_database)
    to role identifier($whaly_bi_role);
```

{% hint style="info" %}
Whenever adding new schemas into your Snowflake database on which you to get access to Whaly, please run the following query :arrow\_down\_small:
{% endhint %}

```
set whaly_bi_role = 'WHALY_BI_ROLE';
set snowflake_database = 'INSERT_PROPER_DATABASE_NAME_TO_EXPOSE_IN_WHALY_BI';
set snowflake_schema = 'INSERT_PROPER_SCHEMA_NAME';

USE DATABASE identifier($snowflake_database);
grant USAGE
    on schema identifier($snowflake_schema)
    to role identifier($whaly_bi_role);
```

### 2bis. Granular access | Give access to Whaly BI to a SINGLE Schema and ALL its Tables located in a Snowflake database

```
set whaly_bi_role = 'WHALY_BI_ROLE';
set snowflake_database = 'INSERT_PROPER_DATABASE_NAME_TO_EXPOSE_IN_WHALY_BI';
set snowflake_schema = 'INSERT_PROPER_SCHEMA_NAME';

USE DATABASE identifier($snowflake_database);
grant USAGE
    on schema identifier($snowflake_schema)
    to role identifier($whaly_bi_role);
grant SELECT 
    on all tables in schema identifier($snowflake_schema)
    to role identifier($whaly_bi_role);
grant SELECT 
    on future tables in schema identifier($snowflake_schema)
    to role identifier($whaly_bi_role);
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.whaly.io/warehouse/snowflake/giving-access-to-snowflake-data.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
