Skip to main content
Snowflake is a cloud-based data warehousing platform that enables scalable and efficient data storage and analysis. Starting with v2.6.0, RisingWave introduced the Snowflake v2 sink connector, providing a more powerful and improved integration. The original Snowflake connector remains supported for compatibility, but we recommend using Snowflake v2 for more powerful and comprehensive functionality.

Syntax

To use Snowflake v2, specify connector = 'snowflake_v2' in your CREATE SINK statement.

Parameters

S3 parameters These options only need to be set when with_s3 = true: Authentication parameters

Authentication

Snowflake v2 sink connector supports three authentication methods:
  1. Password authentication (default): Standard username/password authentication
  2. Key-pair authentication with file: Uses a private key file path
  3. Key-pair authentication with PEM content: Uses PEM-formatted private key content directly

Password authentication

This is the default authentication method. Provide your Snowflake username and password:
Example

Key-pair authentication with file

For enhanced security, you can use key-pair authentication with RSA private keys stored in a file. This method requires:
  • Setting auth.method = 'key_pair_file'
  • Providing the path to your private key file via private_key_file
  • Optionally providing the passphrase via private_key_file_pwd if the key is encrypted
Example

Key-pair authentication with PEM content

You can provide the PEM-formatted private key directly in the sink definition.
Alternatively, you can store the private key securely using CREATE SECRET and reference the secret in the sink configuration.
Example

Auto schema change

PREMIUM FEATUREThis is a premium feature. For a comprehensive overview of all premium features and their usage, please see RisingWave premium features.
Snowflake v2 sinks support auto schema change to automatically adapt their output schema according to changes in the upstream table. This feature is supported only when sink_decoupling is disabled. Once auto schema change is enabled, if you add new columns to the source table, the sink will automatically update to match the new schema. This reduces manual intervention and makes your data pipelines more robust to schema evolution. To enable it, set the following option when creating the sink:

Configure RisingWave to write to S3

You need to configure how RisingWave authenticates with AWS S3. There are two primary methods:
  • Access Key / Secret Key (AK/SK) authentication
This is the default method. Provide your AWS Access Key ID and Secret Access Key directly in the CREATE SINK statement.
  • Assume role authentication
For enhanced security, RisingWave can assume an IAM Role in your AWS account to gain temporary credentials for S3 access.
To use this method, you need to configure an IAM Role in AWS that RisingWave can assume. This involves:
  1. Obtaining the RisingWave Cloud IAM role ARN (Workload Identity (IAM Role ARN)) from the Cloud metadata page in the Console (ConnectionCloud Meta tab).
  2. Creating an IAM policy with the necessary S3 read/write permissions for your bucket and prefix.
  3. Configuring the IAM Role’s trust policy to use the RisingWave Cloud IAM role ARN as the trusted principal.
For a complete step-by-step walkthrough, see Set up IAM role assume.

Append-only and upsert modes

Snowflake v2 sink connector supports both modes for flexible data handling. In upsert mode, performance is optimized through the use of an intermediate table:
  • An intermediate table is created to stage data before merging it into the target table. If create_table_if_not_exists is set to true, the table is automatically named rw_<target_table_name>_<uuid>.
  • Data is written to intermediate storage (S3) at intervals defined by write.intermediate.interval.seconds (default: 1800 seconds).
  • Data is periodically merged from the intermediate table into the target table according to the write.target.interval.seconds setting (default: 3600 seconds).
  • By default, an S3 bucket is required to achieve optimal ingestion performance into the intermediate table.
  • Alternatively, you can use INSERT SQL statements to load data directly into the intermediate table, though this approach is not recommended due to performance drawbacks.
Examples:
  1. Snowflake v2 sink with S3 writer (Append-only mode)
  1. Snowflake v2 sink with S3 writer (Upsert mode):

Set up Snowflake

Before connecting RisingWave to Snowflake, you need to prepare a dedicated user, role, schema, and warehouse in Snowflake. If you already have a Snowflake user with the necessary privileges, you can skip this step. Follow the steps below to create and configure the required resources.
  1. Set database_namewarehouse_name, and rw_schema accordingly to use an existing database, warehouse, and/or schema.
Example
  1. Create role and schema for RisingWave.
  1. Create Snowflake database.
  1. Create a user for RisingWave.
  1. Create a warehouse for RisingWave.
  1. Grant RisingWave role access to warehouse.
  1. Grant RisingWave access to database.

Set up Snowflake S3 integration

To enable RisingWave to write data into Snowflake through S3, you need to set up a Snowflake Storage Integration and a Stage in Snowflake. Follow these steps:
  1. Use ACCOUNTADMIN role in RW_DB.RW_SCHEMA created above.
  1. Create a Snowflake storage integration that connects to your S3 bucket. Replace the ARN and S3 path with your own.
  1. Configure IAM trust policy
Run the following command to retrieve values required for the AWS IAM trust policy.
From the output, copy STORAGE_AWS_IAM_USER_ARN(e.g. arn:aws:iam::398211280607:user/....) and STORAGE_AWS_EXTERNAL_ID(e.g. ....c9aPS5npkOTkSO8=) to configure AWS IAM trusted policy.
  1. Validate that Snowflake can access your S3 bucket.
  1. Create an external stage.
If you want to use public or other roles, you need to fully configure and grant these privileges:

Set up S3 IAM and role

RisingWave supports direct access to S3 using Access Key / Secret Key (AK/SK) by default. If you prefer to set up S3 IAM and role, follow the official Snowflake guide. Below are additional notes specific to RisingWave.
  1. Create an IAM policy for S3 access.
Example
  1. Configure the following additional trusted entities for your IAM Role to allow RisingWave to assume the role. Obtain the Workload Identity (IAM Role ARN) from the Cloud metadata page (ConnectionCloud Meta tab). See Set up IAM role assume for a complete walkthrough.
Example