Snowflake Wrapper
Overview
Snowflake Wrapper
Snowflake is the AI Data Cloud: a cloud-based platform used by more than 13,000 organizations worldwide for data warehousing, analytics, and AI application development. It runs across AWS, Azure, and Google Cloud, providing a single platform for structured and unstructured data with built-in governance and AI capabilities.
The Snowflake Wrapper brings your Snowflake data into Postgres as queryable foreign tables. Read and write Snowflake tables and views with plain SQL and join them against your application data. The wrapper uses key-pair authentication to access Snowflake's SQL REST API, works with Supabase Vault for secure private key management, and is built on WebAssembly (Wasm) for lightweight, sandboxed execution.
Supported Operations
| Object | Select | Insert | Update | Delete |
|---|---|---|---|---|
| Tables / Views | ✅ | ✅ | ✅ | ✅ |
Supported Data Types
| Postgres Type | Snowflake Type |
|---|---|
| boolean | BOOLEAN |
| smallint | SMALLINT |
| integer | INT |
| bigint | BIGINT |
| float | FLOAT4 |
| double precision | FLOAT8 |
| numeric | NUMBER |
| text | VARCHAR |
| date | DATE |
| timestamp | TIMESTAMP_NTZ |
| timestamptz | TIMESTAMP_TZ |
Preparation
Before you get started, make sure the wrappers extension is installed on your database:
_10create extension if not exists wrappers with schema extensions;
and then enable the Wasm foreign data wrapper:
_10create foreign data wrapper wasm_wrapper_10 handler wasm_fdw_handler_10 validator wasm_fdw_validator;
About authentication
This wrapper uses key-pair authentication to access the Snowflake SQL REST API. See Snowflake's key-pair authentication docs for setup instructions before proceeding.
Secure your credentials (optional)
By default, Postgres stores FDW credentials inside pg_catalog.pg_foreign_server in plain text. Anyone with access to this table will be able to view these credentials. Wrappers is designed to work with Vault, which provides an additional level of security for storing credentials. We recommend using Vault to store your credentials.
_10select vault.create_secret(_10 E'-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----',_10 'snowflake',_10 'Snowflake private key for Wrappers'_10);
Connecting to Snowflake
We need to provide Postgres with the credentials to connect to Snowflake, and any additional options. We can do this using the create server command:
With Vault:
_13create server snowflake_server_13 foreign data wrapper wasm_wrapper_13 options (_13 fdw_package_url 'https://github.com/supabase/wrappers/releases/download/wasm_snowflake_fdw_v0.2.1/snowflake_fdw.wasm',_13 fdw_package_name 'supabase:snowflake-fdw',_13 fdw_package_version '0.2.1',_13 fdw_package_checksum '9863b913308f2700090db7f2f8b50751524a39d743b401830cdae98cbace650e',_13 account_identifier 'MYORGANIZATION-MYACCOUNT',_13 user 'MYUSER',_13 public_key_fingerprint 'SizgPofeFX0jwC8IhbOfGFyOggFgo8oTOS1uPLZhzUQ=',_13 private_key_id '<key_ID>', -- The Key ID from above._13 timeout_secs '60' -- Optional. Default 60, range [0, 6048]._13 );
Without Vault:
_13create server snowflake_server_13 foreign data wrapper wasm_wrapper_13 options (_13 fdw_package_url 'https://github.com/supabase/wrappers/releases/download/wasm_snowflake_fdw_v0.2.1/snowflake_fdw.wasm',_13 fdw_package_name 'supabase:snowflake-fdw',_13 fdw_package_version '0.2.1',_13 fdw_package_checksum '9863b913308f2700090db7f2f8b50751524a39d743b401830cdae98cbace650e',_13 account_identifier 'MYORGANIZATION-MYACCOUNT',_13 user 'MYUSER',_13 public_key_fingerprint 'SizgPofeFX0jwC8IhbOfGFyOggFgo8oTOS1uPLZhzUQ=',_13 private_key E'-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----',_13 timeout_secs '60' -- Optional. Default 60, range [0, 6048]._13 );
Note: the fdw_package_* options are required and specify the Wasm package metadata. See the Available Versions table above for the full list.
Resources
Details
Third-party integrations and docs are managed by Supabase partners.