Export Postgres data, stage files, then COPY INTO Snowflake tables for a fast, reliable migration.
Export tables to flat files (CSV or Parquet), upload them to a Snowflake stage, and run COPY INTO
to load data. This pipeline avoids row-by-row inserts and fully leverages Snowflake’s parallel loaders.
psql for exporting, AWS CLI or Snowflake PUT
for staging, and SnowSQL or Galaxy’s AI-powered editor for running Snowflake SQL. ETL platforms like Fivetran work too but cost more.
Use COPY
or \copy
to write compressed CSV files. Keep header rows for easier column mapping.
Internal stage keeps everything inside Snowflake; an S3-backed external stage scales for large datasets.
Run PUT file://...
for internal stages or aws s3 cp
for external. Verify with LIST @stage
.
Mirror Postgres schema, but switch data types (e.g., TEXT ➜ STRING
, SERIAL ➜ IDENTITY
). Add clustering keys later.
Execute COPY INTO
with FILE_FORMAT
options and ON_ERROR
strategy (CONTINUE
, SKIP_FILE
, or ABORT
).
Compare row counts and checksums between Postgres and Snowflake. Re-run loads with VALIDATE()
if errors appear.
Capture changes with logical replication or use Snowpipe/Streams + Tasks to keep Snowflake current until cut-over.
Split exports by date or ID range, compress with GZIP, and use parallel PUT
uploads.In Snowflake, set MAX_FILE_SIZE
to balance parallelism versus overhead.
Run a full load, then continuously ship WAL or CDC events. Switch applications only after deltas are caught up and validated.
Create IDENTITY
columns in Snowflake, but stop Postgres inserts before final sync or remap IDs during load.
Store export, staging, and load queries in a shared Galaxy Collection. Teammates can endorse and reuse the scripts, ensuring a repeatable migration runbook.
.
Yes. Use logical replication, Debezium, or Fivetran to stream changes into Snowflake. Alternatively, stage hourly CSV extracts and automate COPY INTO with Tasks.
Export files to S3, then create an external Snowflake stage pointing to the bucket. Load data into VARIANT or BINARY columns.
When using S3 stages you need an AWS IAM role with GetObject
permissions. Snowflake’s wizard generates a trust policy snippet to paste into AWS.