# Snowflake
## Installation

1. Install package

  **If you are developing with binary, the package is already bundled in the binary. You can skip this step.**

   ```bash
   npm i @vulcan-sql/extension-driver-snowflake
   ```

2. Update `vulcan.yaml`, and enable the extension.

   ```yaml
   extensions:
     ...
     // highlight-next-line
     snow: '@vulcan-sql/extension-driver-snowflake' # Add this line
   ```

3. Create a new profile in `profiles.yaml` or in your profile files. For example:

   ```yaml
   - name: snow # profile name
     type: snowflake
     connection:
       account: 'xy123456.ap-northeast-1.aws'
       username: xxxx
       password: xxxx
       warehouse: test
       min: 0
       max: 3
     allow: '*'
   ```

## Configuration

Please check [arguments of Snowflake SDK](https://docs.snowflake.com/en/user-guide/nodejs-driver-use.html#setting-the-connection-options) and [options of Generic Pool](https://github.com/coopernurse/node-pool) for further information.

| Name                 | Required | Default   | Description                                                                                                                             |
| -------------------- | -------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| account              | Y        |           | Your account [identifier](https://docs.snowflake.com/en/user-guide/admin-account-identifier.html).                                      |
| username             | Y        |           | The login name for your Snowflake user or your Identity Provider (e.g. your login name for Okta).                                        |
| application          | N        | VulcanSQL | Specifies the name of the client application connecting to Snowflake.                                                                   |
| authenticator        | N        | SNOWFLAKE | Specifies the authenticator to use for verifying user login credentials.                                                                |
| password             | N        |           | Password for the user. Set this option if you set the authenticator option to SNOWFLAKE or the Okta URL endpoint for your Okta account. |
| token                | N        |           | Specifies the OAuth token to use for authentication. Set this option if you set the authenticator option to OAUTH.                      |
| privateKey           | N        |           | Specifies the private key (in PEM format) for key pair authentication                                                                   |
| privateKeyPath       | N        |           | Specifies the local path to the private key file (e.g. rsa_key.p8)                                                                      |
| privateKeyPass       | N        |           | Specifies the passcode to decrypt the private key file, if the file is encrypted.                                                       |
| database             | N        |           | The default database to use for the session after connecting.                                                                           |
| warehouse            | N        |           | The default virtual warehouse to use for the session after connecting. Used for performing queries, loading data, etc.                  |
| timeout              | N        | 60000     | Number of milliseconds to keep the connection alive with no response.                                                                   |
| role                 | N        |           | The default security role to use for the session after connecting.                                                                      |
| schema               | N        |           | The default schema to use for the session after connecting.                                                                             |
| max                  | N        | 1         | Maximum number of connection to create at any given time.                                                                               |
| min                  | N        | 0         | Minimum number of connection to keep at any given time. If this is set >= max, the pool will silently set the min to equal max.         |
| maxWaitingClients    | N        | 0         | Maximum number of queued connections allowed.                                                                                           |
| acquireTimeoutMillis | N        | 0         | Max milliseconds a request will wait for a connection before timing out, if supplied should non-zero positive integer.                  |
| destroyTimeoutMillis | N        | 0         | Max milliseconds a connection will wait for closing before timing out, if supplied should non-zero positive integer.                    |
