Snowflake Adapter

Generate Snowflake SQL from your model.

What the adapter emits

  • Identifiers in "double quotes"; bare column names in expressions are lowercased, so quote a column that was created with a mixed-case name.
  • Date literals as '2026-01-01'::DATE; grain truncation as DATE_TRUNC('month', x); parts with YEAR(x), MONTH(x), DAYOFWEEK(x).
  • CTEs for the per-fact subqueries and a FULL OUTER JOIN when a query blends measures from two facts.

Configuration

snowflake_dw:
  adapter: snowflake
  name: Snowflake Data Warehouse
  tier: hot
  account_identifier: myorg-myaccount
  database: ANALYTICS_DB
  warehouse: COMPUTE_WH
  schema: PUBLIC
  role: ANALYST
  username: analyst
  # personal_access_token or private_key: never here; your application holds them

Connection fields

The server never connects to Snowflake: it has no database driver in it, and the only keys the deployed model keeps are adapter, tier and the name. Your application runs the statement it gets back, with its own credentials.

zsql on this machine does connect, read-only, for zsql catalog, zsql sample and zsql run. It uses the SQL REST API with a personal_access_token, or username plus an RS256 key pair (private_key_file, or private_key in .zsql), against account. Secrets go in .zsql or ZSQL_DS_<KEY>_<FIELD>, never in datasources.yml; zsql deploy strips password, private_key, personal_access_token, oauth_client_id and oauth_client_secret from the file if present. See Connecting to a warehouse.

Notes

  • Expressions are Snowflake SQL. approx_count_distinct, hll, median, listagg and iff are fine in expression.sql.
  • Qualify tables in physical_name (ANALYTICS_DB.PUBLIC.STORE_SALES) if your application’s session does not set a default database and schema.

Next Steps