--- title: "Snowflake Write-Back Integration | Sync Data from RevSure" slug: "snowflake-write-back-integration-implementation" description: "Implement Snowflake write-back integration in RevSure to enable real-time data syncing and improve cross-platform intelligence." updated: 2026-09-17T04:22:32Z published: 2026-09-17T04:22:32Z canonical: "documents.revsure.ai/snowflake-write-back-integration-implementation" --- > ## Documentation Index > Fetch the complete documentation index at: https://documents.revsure.ai/llms.txt > Use this file to discover all available pages before exploring further. # Snowflake Write-back Integration Implementation ## Snowflake Destination — Prerequisites Before setting up Snowflake as a destination in RevSure, the customer should ensure the following are available: - Snowflake account with a dedicated user for the integration - Warehouse that RevSure can use - Database and schema where RevSure data will be written - Snowflake role granted to that user, with: - `USAGE` on the warehouse, database, and schema - `CREATE TABLE` on the target schema - `SELECT, INSERT, UPDATE, DELETE ` on current and future tables in the schema - `REFERENCES` on tables in the schema - Auth ready for the RevSure connection: Snowflake OAuth (Client ID + Client Secret) or RSA key pair - Network policies or IP allowlists that permit the RevSure connection Values to have on hand for the RevSure Destination form: - Account URL (e.g. `https://<account>.snowflakecomputing.com`) - Warehouse, database, schema, and role names - OAuth Client ID + Client Secret, or RSA username + private key (and passphrase if the key is encrypted) Once these are configured, the customer can authenticate with Snowflake from the RevSure Destination setup flow (Data Hub → Data Destinations → Snowflake), then add workflows for the tables to sync. ## **Overview** This document outlines the process and requirements for integrating your marketing attribution platform with a customer's Snowflake instance. The integration will allow data from your platform to be written back into the customer’s Snowflake instance. Two primary approaches are covered: 1. **RevSure Airflow Spark Job to Snowflake:** Direct integration using Spark to load data into Snowflake. 2. **RevSure Airflow to S3 to Snowflake:** Data loaded to S3 first, then copied into Snowflake. ## Flow Diagram Write-back flow gets initialized after the Primary Connection Sync (e.g., Salesforce) finishes. 1. **RevSure Airflow Spark Job to Snowflake**: Data processing is managed by Spark jobs that directly write data into Snowflake via the Snowflake Spark connector. 2. **RevSure Airflow to S3 to Snowflake**: Data is first uploaded to an S3 bucket and then loaded into Snowflake via Snowflake's COPY INTO command. ## **Pre-requisites** The prerequisites listed below are to be provided by the customer to RevSure. ### Common For Both Approaches #### **Snowflake Setup** 1. The customer should have a Snowflake instance, database, schema, and tables where the data will be written. 2. A dedicated Snowflake user account with necessary permissions (INSERT, UPDATE, DELETE). 3. IP whitelisting or Private Link configuration to enable secure access from the platform’s network to Snowflake. #### **Security** 1. Use encryption (TLS/SSL) for data in transit and at rest (Snowflake and S3). 2. Ensure that appropriate IAM roles and policies are in place to secure the interaction between services. ### **For RevSure Airflow to S3 to Snowflake** #### **S3 Setup** 1. AWS S3 bucket for intermediary storage. 2. AWS access credentials (Access Key ID and Secret Access Key) or role-based access for S3 uploads. ## **Technical Implementation** ### **RevSure Airflow Spark Job to Snowflake** #### Architecture Overview In this setup, after the Primary Connection finishes the Projection Pipeline, RevSure Airflow triggers a Spark job that processes and writes data directly into Snowflake using the Snowflake Spark connector. This is an efficient solution for large datasets and complex transformations. #### Steps 1. **Connection Setup**: 1. **Snowflake JDBC URL**: Use the JDBC URL provided by the customer for Snowflake. 2. **Credentials Storage**: Store credentials securely using Airflow Variables or GCP Secret Manager. Example JDBC URL: ```java jdbc:snowflake://.snowflakecomputing.com/?user=&password=&warehouse=&db=&schema= ``` 1. **Spark Job**: 1. Install the Snowflake Spark connector on the cluster and configure the data flow to Snowflake. Example Scala Code: ```scala val snowflakeOptions = Map( "sfURL" -> ".snowflakecomputing.com", "sfUser" -> "", "sfPassword" -> "", "sfDatabase" -> "", "sfSchema" -> "", "sfWarehouse" -> "" ) val df = spark.read .format("snowflake") .options(snowflakeOptions) .option("dbtable", "your_table") .load() ``` ### **RevSure Airflow to S3 to Snowflake** #### Architecture Overview Data is written to an intermediate S3 bucket before being loaded into Snowflake using the COPY INTO command. This approach is simpler to manage, especially when dealing with moderate data volumes. #### **Steps** 1. **Data Upload to S3**: 1. Configure Airflow to upload files to S3 using AWS SDK (boto3). Example Python Code for Airflow Task: ```python import boto3 def upload_to_s3(**kwargs): s3 = boto3.client('s3') s3.upload_file('/path/to/local/file.csv', 'bucket_name', 'file.csv') ``` 1. **Copy Data into Snowflake**: 1. Use the Snowflake COPY INTO command to load data from the S3 bucket into Snowflake. Example SQL Command: ```pgsql COPY INTO my_table FROM @my_s3_stage FILE_FORMAT = (TYPE = 'CSV' FIELD_OPTIONALLY_ENCLOSED_BY='"') ON_ERROR = 'skip_file'; ```