Different Ways to Load Data into Snowflake

Loading data into Snowflake can be done using several methods depending on the source, format, size, and frequency of data. Here's a comprehensive breakdown:


๐Ÿš€ 1. Snowflake Web UI (Snowsight)

Best for: Small, manual uploads.


Drag and drop files (CSV, JSON, Parquet, etc.)


Creates an internal stage and loads data into a table.


GUI-based, no code needed.


๐Ÿ—ƒ️ 2. Using SnowSQL (CLI)

Best for: Automating via scripts or command line.


Steps:


Upload to a stage (internal or external):


bash

Copy

Edit

snowsql -q "PUT file://path/to/file.csv @my_stage"

Load into table:


bash

Copy

Edit

snowsql -q "COPY INTO my_table FROM @my_stage FILE_FORMAT = (TYPE = CSV)"

๐ŸŒ 3. Using External Stages (S3, Azure Blob, GCS)

Best for: Cloud-based, large-scale, automated loads.


Define external stage:


sql

Copy

Edit

CREATE STAGE my_s3_stage

URL='s3://my-bucket/data/'

CREDENTIALS=(AWS_KEY_ID='xxx' AWS_SECRET_KEY='xxx');

Load:


sql

Copy

Edit

COPY INTO my_table FROM @my_s3_stage FILE_FORMAT = (TYPE = CSV);

๐Ÿ” 4. Snowpipe (Continuous Ingestion)

Best for: Real-time or near real-time loading.


Automatically loads files as soon as they appear in a stage.


Can integrate with cloud storage event notifications.


Define a pipe:


sql

Copy

Edit

CREATE PIPE my_pipe AS

COPY INTO my_table FROM @my_stage FILE_FORMAT = (TYPE = JSON);

๐Ÿงช 5. Snowflake Connector for Python / Other SDKs

Best for: Programmatic loading.


Using Python:


python

Copy

Edit

import snowflake.connector


conn = snowflake.connector.connect(...)

cursor = conn.cursor()

cursor.execute("PUT file://path.csv @my_stage")

cursor.execute("COPY INTO my_table FROM @my_stage FILE_FORMAT=(TYPE=CSV)")

๐Ÿ“ก 6. Third-Party ETL Tools

Best for: Complex workflows, transformation, scheduling.


Popular tools:


Fivetran


Stitch


Talend


Informatica


Matillion


dbt (for transformations post-load)


๐Ÿงฐ 7. Snowflake Data Marketplace & Shares

Best for: Loading external or shared datasets.


Consume shared datasets directly without data movement.


Use CREATE DATABASE FROM SHARE to access shared data.


๐Ÿงพ 8. Data Loading via SQL Scripts

Use COPY INTO, INSERT INTO, or MERGE for batch inserts or transformations post-load.

Learn  Data Engineering Snowflake course

Read More

Data Loading in Snowflake

A Step-by-Step Guide to Creating Tables in Snowflake

Snowflake’s Virtual Warehouses Explained

Visit Our Quality Thought Training Institute in Hyderabad

Get Directions

Comments

Popular posts from this blog

Understanding Snowflake Editions: Standard, Enterprise, Business Critical

Why Data Science Course?

How To Do Medical Coding Course?