An end-to-end ETL (Extract, Transform, Load) pipeline built using Python, Pandas, and Snowflake to process and analyze sales data.
The project demonstrates a complete data engineering workflow where raw CSV data is extracted, validated, transformed, loaded into Snowflake, automated using Snowflake Tasks, and analyzed using SQL queries to generate business insights.
CSV Data Source
↓
Python Extraction Layer
↓
Data Validation & Transformation
↓
Snowflake Internal Stage
↓
COPY INTO Command
↓
Raw Table
↓
Stored Procedure + Snowflake Task
↓
Final Sales Table
↓
SQL Analytics
- Python
- Pandas
- Snowflake
- SQL
- Snowflake Connector for Python
- Python-dotenv
- Pytest
snowflake_etl_project
│
├── data
│ └── sales.csv # Input sales dataset
│
├── src
│ ├── db.py # Snowflake connection handling
│ ├── extract.py # Extract data from CSV
│ ├── transform.py # Data cleaning and validation
│ ├── load.py # Load data into Snowflake
│ ├── logger.py # Pipeline logging configuration
│ ├── main.py # ETL pipeline execution
│ └── __init__.py
│
├── tests
│ ├── test_transform.py # Transformation testing
│ └── test_connection.py # Snowflake connection testing
│
├── sql
│ ├── etl_pipeline.sql # Snowflake database setup and automation
│ └── analytics.sql # Business analytics queries
│
├── logs
│ └── etl.log # Pipeline execution logs
│
├── .env # Snowflake credentials
├── pytest.ini # Pytest configuration
├── requirements.txt
└── README.md
The extraction layer reads sales data from CSV files using Pandas.
Process:
sales.csv
↓
Pandas DataFrame
↓
ETL Processing
Features:
- Input file validation
- Structured data extraction
- Logging of extraction process
The transformation layer performs data preprocessing and feature creation.
Implemented operations:
- Missing value detection
- Missing value handling
- Duplicate record identification
- Duplicate removal
- Data validation
- Business metric creation
Example:
TOTAL_SALES = QUANTITY × PRICE
This creates a calculated revenue field used for analytics.
The pipeline includes validation checks before loading data.
Implemented checks:
- Missing value validation
- Duplicate record detection
- Required column validation
- Transformation verification
This ensures only clean data reaches Snowflake.
The loading layer connects Python with Snowflake using the Snowflake Connector.
Processed data is loaded into Snowflake tables.
Loading process:
Python DataFrame
↓
Snowflake Connection
↓
SALES Table
Features:
- Secure credential management using environment variables
- Error handling
- Transaction rollback support
- Execution logging
ETL_DB
SALES_SCHEMA
CSV File
↓
Snowflake Internal Stage
↓
COPY INTO SALES_RAW
↓
Stored Procedure Transformation
↓
SALES_FINAL
↓
Analytics
Used to store and manage incoming CSV files before ingestion.
Used for loading staged files into Snowflake tables.
Created reusable SQL logic for transforming and loading processed sales data.
Implemented scheduled execution of data loading workflows.
Example:
Task Schedule:
Every 5 minutes
This reduces manual execution of ETL operations.
Database:
ETL_DB
Schema:
SALES_SCHEMA
Tables:
Stores incoming raw data.
Columns:
| Column | Description |
|---|---|
| ORDER_ID | Unique order identifier |
| CUSTOMER_NAME | Customer name |
| PRODUCT | Product name |
| QUANTITY | Units purchased |
| PRICE | Product price |
| ORDER_DATE | Date of order |
Stores transformed business-ready data.
Additional column:
| Column | Description |
|---|---|
| TOTAL_SALES | Revenue generated per order |
Formula:
TOTAL_SALES = QUANTITY * PRICE
Created SQL queries to generate business insights.
Analytics performed:
- Total revenue calculation
- Overall sales performance
- Product-wise revenue
- Best-performing products
- Sales ranking
- Customer spending analysis
- Order frequency analysis
- Monthly revenue trends
- Business performance analysis
Implemented unit testing using Pytest.
Test coverage:
- Transformation logic validation
- Snowflake connection validation
Run tests:
pytestClone repository:
git clone <repository-url>Navigate:
cd snowflake_etl_projectInstall dependencies:
pip install -r requirements.txtCreate .env file:
SNOWFLAKE_USER=
SNOWFLAKE_PASSWORD=
SNOWFLAKE_ACCOUNT=
SNOWFLAKE_WAREHOUSE=
SNOWFLAKE_DATABASE=
SNOWFLAKE_SCHEMA=Execute:
python -m src.mainPipeline execution:
Extract Data
↓
Transform Data
↓
Validate Data
↓
Load Into Snowflake
↓
Generate Analytics
- End-to-end ETL pipeline implementation
- Python and Snowflake integration
- Snowflake internal stage implementation
- COPY INTO data loading
- Data cleaning and validation
- Stored procedure based transformation
- Scheduled Snowflake Task automation
- SQL analytics layer
- Logging and error handling
- Unit testing using Pytest
- Incremental data processing using Snowflake Streams
- Cloud storage integration (AWS S3 / Azure Blob)
- Advanced monitoring and alerting
- Pipeline performance optimization