How to Migrate from Snowflake to ClickHouse

Galaxy Glossary

How do I migrate data and schema from Snowflake to ClickHouse?

Move data and schema from Snowflake to ClickHouse with staged files, CREATE TABLE, and INSERT INTO SELECT.

Sign up for the latest in SQL knowledge from the Galaxy Team!
Welcome to the Galaxy, Guardian!
Oops! Something went wrong while submitting the form.

Description

Why migrate Snowflake data to ClickHouse?

Cut storage costs, achieve sub-second analytics, and keep full SQL support by off-loading historical or high-volume tables to ClickHouse.

What are the high-level steps?

1) Export Snowflake tables to external storage (S3/GCS). 2) Generate compatible DDL for ClickHouse. 3) Load files into ClickHouse. 4) Validate row counts and query results.

How do I export Snowflake tables?

Use COPY INTO @stage to write compressed Parquet files to cloud storage.Partition large tables by date to enable parallel loads.

Example

COPY INTO @mystage/orders FROM Orders FILE_FORMAT=(TYPE=PARQUET COMPRESSION=SNAPPY);

How do I create equivalent ClickHouse tables?

Translate Snowflake data types to ClickHouse types.Generate DDL with ORDER BY and PRIMARY KEY for query speed.

Example

CREATE TABLE Orders (id UInt64, customer_id UInt64, order_date Date, total_amount Decimal(12,2)) ENGINE = MergeTree() ORDER BY (order_date,id);

What’s the quickest way to load data?

Point ClickHouse at the export bucket with s3 table function or use clickhouse-client --query piping.

Example

INSERT INTO Orders SELECT * FROM s3('https://bucket/orders/*.parquet', 'aws_key', 'aws_secret', 'Parquet');

How do I validate the migration?

Compare counts and sample aggregates: SELECT count(*) FROM Orders.Cross-check totals with Snowflake to catch truncation or type mismatch.

Which tools automate the process?

Open-source clickhouse-migrator, Airbyte, and dbt can orchestrate export, DDL generation, and load retries.

Best practices for large tables?

• Compress Parquet files
• Use 64–128 MB file size for balanced parallelism
• Set max_partitions_per_insert_block in ClickHouse to avoid small parts

How do I keep data in sync?

Schedule hourly incremental exports using Snowflake streams and load them with ClickHouse Kafka engine or simple cron jobs.

How to revert quickly?

Retain Snowflake for critical workloads until ClickHouse has passed acceptance tests.Enable dual-write in ETL pipelines for a grace period.

What are common performance tweaks?

Use column compression codecs, increase max_threads, and align ORDER BY keys with common filters such as order_date.

When should I avoid migrating?

If you need ANSI compliant transactions, native time-travel, or automatic clustering without manual tuning, Snowflake may still fit better.

.

Why How to Migrate from Snowflake to ClickHouse is important

How to Migrate from Snowflake to ClickHouse Example Usage


-- Move Orders and join with Products during load
INSERT INTO OrderItems
SELECT oi.id, oi.order_id, p.id AS product_id, oi.quantity
FROM s3('https://ecom-export/order_items/*.parquet',
        'AWS_KEY', 'AWS_SECRET', 'Parquet') AS oi
LEFT JOIN Products AS p ON oi.product_id = p.id;

How to Migrate from Snowflake to ClickHouse Syntax


-- 1. Export from Snowflake
COPY INTO @mystage/customers
  FROM Customers
  FILE_FORMAT=(TYPE=PARQUET COMPRESSION=SNAPPY);

-- 2. Retrieve Parquet files to S3 bucket `s3://ecom-export/customers/`

-- 3. Create matching ClickHouse table
CREATE TABLE Customers (
    id UInt64,
    name String,
    email String,
    created_at DateTime
) ENGINE = MergeTree()
ORDER BY (created_at, id);

-- 4. Load data into ClickHouse
INSERT INTO Customers
SELECT *
FROM s3('https://ecom-export/customers/*.parquet',
        'AWS_KEY', 'AWS_SECRET', 'Parquet');

Common Mistakes

Frequently Asked Questions (FAQs)

Can I migrate without cloud storage?

Yes. Use COPY INTO LOCAL FILE in Snowflake, then clickhouse-client --query piping local Parquet files.

How do I handle Snowflake VARIANT columns?

Store them as ClickHouse JSON or flatten during export using Snowflake’s SELECT variant:field::type pattern.

Is replication possible after initial load?

Yes. Capture changes with Snowflake Streams, export incrementals, and ingest them via ClickHouse Materialized Views or Kafka.

Want to learn about other SQL terms?

Trusted by top engineers on high-velocity teams
Aryeo Logo
Assort Health
Curri
Rubie Logo
Bauhealth Logo
Truvideo Logo
Welcome to the Galaxy, Guardian!
Oops! Something went wrong while submitting the form.