Back to Snowflake & BigQuery Pipeline
Snowflake & BigQuery Pipeline

How to build streaming ingestion pipelines into Snowflake using Snowpipe and Kafka?

Build streaming ingestion pipelines into Snowflake from Kafka using Snowpipe and Kafka Connect by preparing Snowflake objects, creating a Snowpipe, configuring the Snowflake Sink Connector, optionally transforming data, and monitoring for optimal performance.

R
Rajesh Sharma 👑 Tier 3 Elite
Aug 9, 2026 · 3 min read

Snowpipe combined with Kafka Connect provides an efficient, serverless solution for continuous, low-latency data ingestion from Kafka topics into Snowflake tables. This approach leverages Snowflake's native streaming capabilities and Kafka's distributed messaging system for robust data pipelines.

Here's how to build such a pipeline:

1. Prepare Snowflake Objects:
First, create a target table and an external stage in Snowflake. The stage acts as a temporary landing zone for files written by Kafka Connect.
```sql
CREATE DATABASE RAW_DATA;
CREATE SCHEMA KAFKA;
USE SCHEMA RAW_DATA.KAFKA;

CREATE TABLE ORDERS_RAW (
RECORD_METADATA VARIANT,
RECORD_CONTENT VARIANT,
INGESTION_TIMESTAMP TIMESTAMP_NTZ DEFAULT CURRENT_TIMESTAMP()
);

CREATE STAGE KAFKA_STAGE
URL='s3://your-s3-bucket/kafka-data/' -- Or Azure/GCS path
CREDENTIALS=(AWS_KEY_ID='...' AWS_SECRET_KEY='...'); -- Or STORAGE_INTEGRATION
```
For production, use a STORAGE_INTEGRATION instead of direct credentials for enhanced security.

2. Create a Snowpipe:
Define a Snowpipe to automatically load data from the specified stage into your target table as new files arrive. Snowpipe monitors the stage and triggers data loads.
```sql
CREATE PIPE ORDERS_PIPE
AUTO_INGEST=TRUE -- Required for cloud storage event notifications
AS
COPY INTO ORDERS_RAW (RECORD_METADATA, RECORD_CONTENT)
FROM (SELECT METADATA$FILENAME, $1 FROM @KAFKA_STAGE)
FILE_FORMAT = (TYPE = JSON);
```
After creation, retrieve the SQS/SNS/PubSub topic ARN from DESCRIBE PIPE ORDERS_PIPE to configure event notifications for your cloud storage.

3. Configure Kafka Connect with Snowflake Sink Connector:
Install the Confluent Hub Snowflake Sink Connector and configure it to read from your Kafka topic and write to the Snowflake stage. The connector manages file buffering and flushing to the stage, triggering Snowpipe.
```bash
confluent-hub install confluentinc/kafka-connect-snowflake:latest
```
Example connector configuration (snowflake-sink.json):
```json
{
"name": "snowflake-orders-sink",
"config": {
"connector.class": "com.snowflake.kafka.connector.SnowflakeSinkConnector",
"tasks.max": "1",
"topics": "orders_topic",
"snowflake.url.name": "your_account.snowflakecomputing.com",
"snowflake.user.name": "KAFKA_CONNECT_USER",
"snowflake.private.key": "your_private_key_base64",
"snowflake.private.key.passphrase": "your_passphrase",
"snowflake.database.name": "RAW_DATA",
"snowflake.schema.name": "KAFKA",
"snowflake.stage.name": "KAFKA_STAGE",
"snowflake.table.name": "ORDERS_RAW",
"snowflake.role.name": "KAFKA_CONNECT_ROLE",
"value.converter": "org.apache.kafka.connect.json.JsonConverter",
"value.converter.schemas.enable": "false",
"key.converter": "org.apache.kafka.connect.storage.StringConverter",
"key.converter.schemas.enable": "false",
"snowflake.topic2table.map": "orders_topic:ORDERS_RAW"
}
}
```
Ensure your Snowflake user KAFKA_CONNECT_USER has appropriate permissions (USAGE on database/schema, WRITE on stage, INSERT on table, USAGE on pipe).

4. Implement Transformations (Optional):
For basic transformations like flattening nested JSON or renaming fields, use Kafka Connect's Single Message Transforms (SMTs). For complex logic, consider a Kafka Streams application before the sink connector.
```json
{
"name": "snowflake-orders-sink",
"config": {
// ... (previous configs) ...
"transforms": "unwrap",
"transforms.unwrap.type": "org.apache.kafka.connect.json.JsonToStructWithSchemaAndUnwrap",
"transforms.unwrap.field": "payload",
"transforms.unwrap.drop.null.values": "true"
}
}
```
This example SMT assumes your Kafka messages are structured with a payload field containing the actual data.

5. Monitor and Optimize:
Monitor Snowpipe ingestion using SELECT * FROM TABLE(INFORMATION_SCHEMA.SNOWPIPE_STREAMING_HISTORY(DATE_RANGE_START => DATEADD('HOUR', -1, CURRENT_TIMESTAMP()))); or COPY_HISTORY. Adjust Kafka Connect flush.size and flush.interval.ms parameters to balance latency and file size for optimal Snowpipe performance and cost. Aim for file sizes between 100MB and 250MB for efficient ingestion.

Read the evidence

Sources used in this thread

Open the original material, compare the claims, and form your own view.

Community notes

Add context, not noise (0)

Corrections, lived experience, useful examples, and better sources belong here.

Nothing added yet. Be the first to make this thread more useful.
Click here to write a reply...
🔒

Authentication Required

Join Trendzza to begin your journey. Submit tasks, complete batches, help peers, and earn your way to Tier 3.