Snowflake Fundamentals

Learn Snowflake. Build with confidence.

A practical reference guide to Snowflake architecture, warehouses, databases, stages, data loading, Snowpipe, Streams, Tasks, and Time Travel — with ready-to-use SQL.

14 Topics
SQL Examples
S3 Integration
100% Responsive
01
Fundamentals

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.

02
Compute

Warehouses

A warehouse is Snowflake's compute engine. It provides CPU and memory required to execute queries and can automatically suspend when idle.

SQL
CREATE WAREHOUSE my_wh
  WAREHOUSE_SIZE = 'XSMALL'
  AUTO_SUSPEND = 60
  AUTO_RESUME = TRUE;
03
Organization

Databases

A database is the top-level container used to organize schemas, tables, views and other database objects.

SQL
CREATE DATABASE sales_db;

USE DATABASE sales_db;
04
Organization

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.

SQL
CREATE SCHEMA sales_db.raw_data;
05
Storage

Tables

Tables contain the actual rows and columns of your data, similar to tables in traditional relational databases.

SQL
CREATE TABLE customers (
  id INT,
  name STRING,
  email STRING,
  signup_date DATE
);
06
Data Integration

Stages

A stage is a storage location where files are kept before or after loading them into Snowflake. Stages can be internal or external.

SQL
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.

07
SQL

SQL Queries

Snowflake supports standard ANSI SQL. Common commands such as SELECT, JOIN, GROUP BY, WHERE and ORDER BY work as expected.

SQL
SELECT
    customer_id,
    SUM(amount) AS total_sales
FROM sales
GROUP BY customer_id
ORDER BY total_sales DESC;
08
Data Loading

File Formats

A file format tells Snowflake how incoming files should be interpreted. It can define delimiters, headers and other file properties.

SQL
CREATE FILE FORMAT csv_fmt
  TYPE = 'CSV'
  FIELD_DELIMITER = ','
  SKIP_HEADER = 1;
09
Data Engineering

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.

10
Bulk Loading

Bulk Data Loading

COPY INTO loads a batch of files from a stage into a Snowflake table.

SQL
COPY INTO customers
FROM @my_stage
FILE_FORMAT = (FORMAT_NAME = csv_fmt)
ON_ERROR = 'CONTINUE';
11
Continuous Loading

Snowpipe

Snowpipe automatically loads new files into Snowflake when they arrive in cloud storage, making it useful for continuous data ingestion.

SQL
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.

12
Change Data

Streams

A Stream tracks row-level changes such as inserts, updates and deletes made to a table, allowing incremental processing.

SQL
CREATE STREAM orders_stream
ON TABLE orders;
13
Automation

Tasks

A Task automatically executes SQL statements on a schedule. Tasks are often combined with Streams to automate transformations.

SQL
CREATE TASK my_task
  WAREHOUSE = my_wh
  SCHEDULE = '5 MINUTE'
AS
INSERT INTO summary
SELECT * FROM orders_stream;
14
Data Recovery

Time Travel

Time Travel allows you to query, restore or recover historical versions of data within Snowflake's configured retention period.

SQL
SELECT *
FROM orders
AT (OFFSET => -3600);

UNDROP TABLE orders;
🚀
Hands-on Project

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.