Skip to main content

Installation

Install the Snowflake connector:
npm install @evidence-dev/snowflake

Authentication Methods

Snowflake supports multiple authentication methods:
  1. Username/Password (default)
  2. JWT (Key Pair Authentication)
  3. External Browser (SSO)
  4. Okta

Configuration

Username/Password Authentication

name: snowflake
type: snowflake
options:
  account: abc12345.us-east-1
  username: ${SNOWFLAKE_USER}
  password: ${SNOWFLAKE_PASSWORD}
  database: ANALYTICS
  warehouse: COMPUTE_WH
  role: ANALYST
  schema: PUBLIC
  authenticator: userpass

JWT (Key Pair) Authentication

Use public/private key pair authentication for enhanced security.
connection.yaml
name: snowflake
type: snowflake
options:
  account: abc12345.us-east-1
  username: ${SNOWFLAKE_USER}
  database: ANALYTICS
  warehouse: COMPUTE_WH
  authenticator: snowflake_jwt
  private_key: ${SNOWFLAKE_PRIVATE_KEY}
  passphrase: ${SNOWFLAKE_PASSPHRASE}

External Browser (SSO)

Use browser-based SSO authentication.
connection.yaml
name: snowflake
type: snowflake
options:
  account: abc12345.us-east-1
  username: ${SNOWFLAKE_USER}
  database: ANALYTICS
  warehouse: COMPUTE_WH
  authenticator: externalbrowser
  clientStoreTemporaryCredential: true

Okta Authentication

connection.yaml
name: snowflake
type: snowflake
options:
  account: abc12345.us-east-1
  username: ${SNOWFLAKE_USER}
  password: ${SNOWFLAKE_PASSWORD}
  database: ANALYTICS
  warehouse: COMPUTE_WH
  authenticator: okta
  okta_url: https://your-org.okta.com

Configuration Parameters

account
string
required
Snowflake account identifier (e.g., abc12345.us-east-1 or orgname-accountname)
username
string
required
Snowflake username
database
string
required
Database name to connect to
warehouse
string
required
Warehouse name to use for queries
role
string
Role to use for the session
schema
string
Default schema to use
authenticator
string
default:"userpass"
Authentication method: userpass, snowflake_jwt, externalbrowser, or okta
resultPrefetch
number
default:2
Number of result batches to prefetch for improved performance

Username/Password Parameters

password
string
required
Snowflake password

JWT Parameters

private_key
string
required
Private key for JWT authentication (PEM format)
passphrase
string
required
Passphrase for the encrypted private key

External Browser Parameters

clientStoreTemporaryCredential
boolean
default:false
Cache SSO token for faster subsequent connections

Okta Parameters

okta_url
string
required
Full Okta URL for authentication (e.g., https://your-org.okta.com)

Proxy Configuration

Connect through an authenticated proxy server:
connection.yaml
name: snowflake
type: snowflake
options:
  account: abc12345.us-east-1
  username: ${SNOWFLAKE_USER}
  password: ${SNOWFLAKE_PASSWORD}
  database: ANALYTICS
  warehouse: COMPUTE_WH
  proxy:
    host: proxy.company.com
    port: 8080
    username: ${PROXY_USER}
    password: ${PROXY_PASSWORD}
    protocol: http

Proxy Parameters

proxy.host
string
required
Proxy server hostname
proxy.port
number
required
Proxy server port
proxy.username
string
Proxy authentication username
proxy.password
string
Proxy authentication password
proxy.protocol
string
Proxy protocol (http or https)

Features

Type Mapping

Snowflake types are mapped to Evidence types:
  • Numbers: INTEGER, BIGINT, SMALLINT, NUMBER, DECIMAL, NUMERIC, FLOAT, DOUBLE, REAL
  • Strings: VARCHAR, CHAR, STRING, TEXT, TIME
  • Dates: TIMESTAMP, TIMESTAMP_LTZ, TIMESTAMP_NTZ, TIMESTAMP_TZ, DATE
  • Booleans: BOOLEAN

Column Name Normalization

Snowflake returns column names in uppercase by default. The connector automatically converts them to lowercase for consistency with Evidence conventions.

Streaming Results

Queries are executed with streaming enabled, processing results in batches for memory-efficient handling of large datasets.

Example Query

Create a SQL file in your Evidence project:
queries/monthly_sales.sql
SELECT 
  DATE_TRUNC('month', order_date) as month,
  region,
  SUM(amount) as total_sales,
  COUNT(DISTINCT customer_id) as unique_customers
FROM sales.orders
WHERE order_date >= DATEADD(month, -12, CURRENT_DATE())
GROUP BY 1, 2
ORDER BY 1 DESC, 3 DESC

Troubleshooting

Snowflake account identifiers can use different formats:
  • Legacy: abc12345.us-east-1
  • Organization: orgname-accountname
Check your Snowflake URL to determine the correct format.
Ensure the specified warehouse is running or has auto-resume enabled. Cold warehouse starts may cause initial query delays.
Private keys must be in PEM format. Generate key pairs using:
openssl genrsa 2048 | openssl pkcs8 -topk8 -inform PEM -out rsa_key.p8
openssl rsa -in rsa_key.p8 -pubout -out rsa_key.pub
Ensure the specified role has:
  • USAGE on the warehouse
  • USAGE on the database and schema
  • SELECT on required tables/views

Build docs developers (and LLMs) love