Bird
Raised Fist0
SnowflakeHow-ToBeginner · 3 min read

How to Load Parquet Files into Snowflake Quickly and Easily

To load Parquet files into Snowflake, first upload the files to a stage (internal or external). Then use the COPY INTO command specifying FILE_FORMAT = (TYPE = 'PARQUET') to load the data into a Snowflake table.
📐

Syntax

The basic syntax to load Parquet files into Snowflake involves the COPY INTO command. You specify the target table, the stage location of the Parquet files, and the file format as Parquet.

  • table_name: The Snowflake table to load data into.
  • @stage_name/path/: The stage location where Parquet files are stored.
  • FILE_FORMAT = (TYPE = 'PARQUET'): Specifies the file format as Parquet.
sql
COPY INTO table_name
FROM @stage_name/path/
FILE_FORMAT = (TYPE = 'PARQUET');
💻

Example

This example shows how to load Parquet files from an internal stage named my_parquet_stage into a table called sales_data. It assumes Parquet files are already uploaded to the stage.

sql
CREATE OR REPLACE TABLE sales_data (
  id INT,
  product STRING,
  quantity INT,
  price FLOAT
);

COPY INTO sales_data
FROM @my_parquet_stage/
FILE_FORMAT = (TYPE = 'PARQUET');
Output
COPY executed successfully. Loaded 1000 rows into sales_data.
⚠️

Common Pitfalls

  • Not uploading Parquet files to the stage before running COPY INTO.
  • Forgetting to specify FILE_FORMAT = (TYPE = 'PARQUET'), which causes load errors.
  • Schema mismatch between Parquet files and Snowflake table columns.
  • Using incorrect stage path or missing files in the stage.

Always verify the stage contents and table schema before loading.

sql
/* Wrong: Missing FILE_FORMAT causes error */
COPY INTO sales_data
FROM @my_parquet_stage/;

/* Right: Specify Parquet file format */
COPY INTO sales_data
FROM @my_parquet_stage/
FILE_FORMAT = (TYPE = 'PARQUET');
📊

Quick Reference

StepDescription
1. Upload Parquet filesPut your Parquet files into a Snowflake stage (internal or external).
2. Create target tableDefine a Snowflake table matching the Parquet schema.
3. Run COPY INTOUse COPY INTO with FILE_FORMAT = (TYPE = 'PARQUET') to load data.
4. Verify loadCheck row counts and errors after loading.
✅

Key Takeaways

Always upload Parquet files to a Snowflake stage before loading.
Use COPY INTO with FILE_FORMAT = (TYPE = 'PARQUET') to load Parquet data.
Ensure the Snowflake table schema matches the Parquet file schema.
Check stage paths and file availability to avoid load errors.
Verify data load success by checking row counts after COPY INTO.