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

# Connect to Snowflake

DirectQuery Snowflake connector is using [Snowflake JDBC driver](https://github.com/snowflakedb/snowflake-jdbc)
to connect to a database.

## User and Role

To connect DirectQuery to Snowflake, you will first need a User linked to a Role with sufficient privileges.\
You can perform these following actions with a Snowflake 'power user' account.

### Create a Role

This [reference](https://docs.snowflake.com/en/sql-reference/sql/create-role.html) can help you to create a Role.

### Grant required privileges to this Role

DirectQuery required privileges are:

* `USAGE` privilege on target warehouse
* `USAGE` privilege on target database
* `USAGE` privilege on target schema
* `SELECT` privilege on schema queryable objects (tables, views)

This [reference](https://docs.snowflake.com/en/sql-reference/sql/grant-privilege.html) will help you to grant these to your new role.

### Create a User linked to this Role

Last step is to create a User with the following attributes:

* login
* password
* default role (the role you have just created)
* default warehouse (warehouse which will be used to run the queries)
* default namespace (`YOUR_DATABASE.SCHEMA`)

For more help on this step you may refer to user management help [section](https://docs.snowflake.com/en/user-guide/admin-user-management.html#creating-users).

## Basic authentication connection

Connection is done through [DirectQuery Snowflake connector](../../directquery/getting_started#create-the-database-connector) passing the minimal following properties:

* [JDBC connection string](https://docs.snowflake.com/en/user-guide/jdbc-configure.html#jdbc-driver-connection-string)
* login
* password

## Alternative authentication method

Above connection was performed using basic authentication.\
Snowflake offers more elaborated ways of [authentication](https://docs.snowflake.com/en/user-guide/authentication.html).
