Skip to content

SiamakGoudarzi/Retail-Data-Engineering-EndToEnd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Retail Data Warehouse & End-to-End BI Solution

Select Language: English | Deutsch


English: Project Documentation

Project Scope

This project implements a complete data pipeline, migrating transactional records from an operational system into a Star Schema Data Warehouse. The solution focuses on data consistency, historical tracking via SCD Type 2, and advanced analytical reporting using SQL Server and Python.

Data Models

OLTP ER Diagram OLTP ER Diagram

DWH Star Schema DWH Star Schema

Technical Stack

  • Database: SQL Server (OLTP & DWH)
  • ETL Engine: Python (Pandas, PyODBC)
  • Key Features: SCD Type 1 & 2 implementation, Persisted Computed Columns, and Keyword-based Categorization.

Repository Structure

  • sql_scripts/: SQL definitions for schemas and business intelligence queries.
  • python_etl/: ETL logic for data migration and DWH transformation.
  • documentation/: ER diagrams, Star Schema models, and the Product Mapping logic.
  • documentation/images/: Visual architecture and schema diagrams.

Step-by-Step Execution Guide

1. SQL Schema Initialization

  • Execute sql_scripts/01_create_oltp_schema.sql to initialize the operational database and load base master data.
  • Execute sql_scripts/02_create_dwh_schema.sql to deploy the Star Schema structure.

2. Configuration

  • Required libraries: pip install pandas pyodbc.
  • Update the server connection string in the Python scripts to match the local SQL Server instance name.

3. Data Processing (ETL)

  • Run python_etl/01_csv_to_oltp.py: Cleans the source data and populates the OLTP system.
  • Run python_etl/02_oltp_to_dwh.py: Transforms data, applies SCD logic, and populates the Fact table.

4. Analytics & Reporting

  • Use sql_scripts/04_analytical_queries.sql in SSMS to generate reports on RFM Segmentation, Peak Sales Hours, and Regional Performance.

Deutsch: Projektdokumentation

Projektumfang

Implementierung einer vollständigen Daten-Pipeline zur Überführung transaktionaler Daten in ein Star Schema Data Warehouse. Der Fokus liegt auf Datenkonsistenz, Historisierung mittels SCD Typ 2 und Business-Reporting unter Einsatz von SQL Server und Python.

Datenmodelle

OLTP ER-Diagramm OLTP ER-Diagramm

DWH Sternschema DWH Sternschema

Technologie-Stack

  • Datenbank: SQL Server (OLTP & DWH)
  • ETL-Engine: Python (Pandas, PyODBC)
  • Highlights: SCD Typ 2 Implementierung, Persisted Computed Columns und Keyword-basiertes Mapping.

Verzeichnisstruktur

  • sql_scripts/: SQL-Skripte für Datenbank-Schemata und BI-Abfragen.
  • python_etl/: ETL-Skripte für den Datentransfer und die DWH-Transformation.
  • documentation/: ER-Diagramme, Star-Schema-Modelle und die Excel-Mapping-Tabelle.
  • documentation/images/: Architektur-Visualisierungen und Schemadiagramme.

Schritt-für-Schritt-Anleitung zur Ausführung

Schritt 1: Datenbank-Initialisierung

  • Führen Sie sql_scripts/01_create_oltp_schema.sql aus, um die operative Datenbank und die Stammdaten zu erstellen.
  • Führen Sie sql_scripts/02_create_dwh_schema.sql aus, um die Data Warehouse-Struktur (Sternschema) bereitzustellen.

Schritt 2: Konfiguration

  • Benötigte Bibliotheken: pip install pandas pyodbc.
  • Passen Sie den Servernamen in den Python-Skripten an Ihre lokale SQL-Server-Instanz an.

Schritt 3: ETL-Durchführung

  • Starten Sie python_etl/01_csv_to_oltp.py: Bereinigt die Quelldaten und befüllt das OLTP-System.
  • Starten Sie python_etl/02_oltp_to_dwh.py: Transformiert die Daten, wendet die SCD-Logik an und lädt die Faktentabelle.

Schritt 4: Analyse & Reporting

  • Nutzen Sie sql_scripts/04_analytical_queries.sql im SSMS für Berichte wie RFM-Segmentierung, Peak-Sales-Analysen und regionale Performance-Rankings.

Prerequisites / Voraussetzungen

  • Microsoft SQL Server & SSMS
  • Python 3.x
  • Online Retail Dataset

About

End-to-End Retail BI Solution: Automated ETL pipeline transforming raw transaction data into a Star Schema Data Warehouse using SQL Server, Python, and SCD Type 2 logic.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages