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

# Snowflake

> Snowflake adapter configuration for SQLBuild.

Snowflake requires the optional `snowflake-connector-python` dependency:

```bash theme={null}
pip install 'sqlbuild[snowflake]'
# or
uv pip install 'sqlbuild[snowflake]'
```

## Connection config

```toml theme={null}
adapter = "snowflake"

[connection]
account = "my_org-my_account"
user = "my_user"
password = "my_password"
role = "TRANSFORM_ROLE"
warehouse = "TRANSFORM_WH"
database = "ANALYTICS"
schema = "RAW"
```

All fields in `connection` are passed directly to `snowflake.connector.connect()`. See the [Snowflake Connector documentation](https://docs.snowflake.com/en/developer-guide/python-connector/python-connector-connect) for all available options, including key-pair authentication, OAuth, and SSO.

## Session initialization

On connect, SQLBuild runs `USE ROLE`, `USE WAREHOUSE`, `USE DATABASE`, and `USE SCHEMA` statements based on the connection config. These ensure the session context is set correctly regardless of the user's default settings.

## Per-target connections

Use targets to connect to different Snowflake databases or warehouses:

```toml theme={null}
adapter = "snowflake"

[connection]
account = "my_org-my_account"
user = "my_user"
password = "my_password"

[targets.prod]
schema = "prod"

[targets.prod.connection]
role = "PROD_ROLE"
warehouse = "PROD_WH"
database = "PROD_DB"

[targets.dev]
schema = "dev"

[targets.dev.connection]
role = "DEV_ROLE"
warehouse = "DEV_WH"
database = "DEV_DB"
```
