What is Snowflake?
Snowflake is a cloud-based data warehouse platform designed to store and analyze large volumes of data without requiring you to manage physical hardware.
Storage Layer
Stores your data in highly compressed, columnar format.
Compute Layer
Virtual warehouses provide CPU and memory for query execution.
Cloud Services
Handles authentication, metadata, optimization and security.
The separation of storage and compute allows you to scale them independently and pay for compute based on actual usage.
Warehouses
A warehouse is Snowflake's compute engine. It provides CPU and memory required to execute queries and can automatically suspend when idle.
CREATE WAREHOUSE my_wh
WAREHOUSE_SIZE = 'XSMALL'
AUTO_SUSPEND = 60
AUTO_RESUME = TRUE;
Databases
A database is the top-level container used to organize schemas, tables, views and other database objects.
CREATE DATABASE sales_db;
USE DATABASE sales_db;
Schemas
A schema sits inside a database and groups related tables, views and other objects together. Think of it like a folder inside a database.
CREATE SCHEMA sales_db.raw_data;
Tables
Tables contain the actual rows and columns of your data, similar to tables in traditional relational databases.
CREATE TABLE customers (
id INT,
name STRING,
email STRING,
signup_date DATE
);
Stages
A stage is a storage location where files are kept before or after loading them into Snowflake. Stages can be internal or external.
CREATE STAGE ext_stage
URL = 's3://my-bucket/data/'
CREDENTIALS = (
AWS_KEY_ID='***'
AWS_SECRET_KEY='***'
);
Why this matters for your S3 project
An external stage creates the bridge between your Amazon S3 files and Snowflake, allowing Snowflake to read data stored in your S3 bucket.
SQL Queries
Snowflake supports standard ANSI SQL. Common commands such as SELECT, JOIN, GROUP BY, WHERE and ORDER BY work as expected.
SELECT
customer_id,
SUM(amount) AS total_sales
FROM sales
GROUP BY customer_id
ORDER BY total_sales DESC;
File Formats
A file format tells Snowflake how incoming files should be interpreted. It can define delimiters, headers and other file properties.
CREATE FILE FORMAT csv_fmt
TYPE = 'CSV'
FIELD_DELIMITER = ','
SKIP_HEADER = 1;
Data Loading Approaches
Snowflake provides different approaches for loading data. Two important approaches are Bulk Loading and Snowpipe continuous loading.
Bulk Loading
Best for historical batches and periodic data exports.
Snowpipe
Best for automatically loading new files as they arrive.
Commands
COPY INTO for bulk loading and CREATE PIPE for Snowpipe.
Bulk Data Loading
COPY INTO loads a batch of files from a stage into a Snowflake table.
COPY INTO customers
FROM @my_stage
FILE_FORMAT = (FORMAT_NAME = csv_fmt)
ON_ERROR = 'CONTINUE';
Snowpipe
Snowpipe automatically loads new files into Snowflake when they arrive in cloud storage, making it useful for continuous data ingestion.
CREATE PIPE my_pipe
AUTO_INGEST = TRUE
AS
COPY INTO customers
FROM @my_stage
FILE_FORMAT = (FORMAT_NAME = csv_fmt);
S3 → Snowflake
Snowpipe is the key component for automatically ingesting new files from your S3 bucket into Snowflake.
Streams
A Stream tracks row-level changes such as inserts, updates and deletes made to a table, allowing incremental processing.
CREATE STREAM orders_stream
ON TABLE orders;
Tasks
A Task automatically executes SQL statements on a schedule. Tasks are often combined with Streams to automate transformations.
CREATE TASK my_task
WAREHOUSE = my_wh
SCHEDULE = '5 MINUTE'
AS
INSERT INTO summary
SELECT * FROM orders_stream;
Time Travel
Time Travel allows you to query, restore or recover historical versions of data within Snowflake's configured retention period.
SELECT *
FROM orders
AT (OFFSET => -3600);
UNDROP TABLE orders;
S3 + Snowflake Pipeline
Now combine everything you've learned into a real data engineering pipeline.
01 · S3
Store incoming CSV, JSON or Parquet files inside Amazon S3.
02 · Stage
Create an external Snowflake stage that points to S3.
03 · Snowpipe
Automatically ingest newly arriving files.
04 · Streams
Track changes and process only new data.
05 · Tasks
Automate downstream transformations.
06 · Time Travel
Recover or inspect historical data when needed.