As part of IBM Data Engineering Capstone Project, I will assume as an Associate Data Engineer who has recently joined e-commerce organzation, to build data platform for retailer data analytics.
To implement a data warehouse system into e-commerce company, I then have to complete builiding the following five parts in the diagram below.
The Process of Building a Data Platform
- Part A - Establish
Data Staging Areafor temporary storing data from data source - Part B - Build a
Staging Data Warehouseto aggregate disparate source data into a cohensive one before loading data into production data warehouse - Part C - Design a
Sales Reporting Dashboardthat reflects the key metrics of business - Part D -
Synchronize databetween staging and production warehouse by automate incremental loading process of sales data - Part E - Develop a
ETL pipelinethat analyzes the web server log file, extracts the required lines and fields, transforms and loads into a file for further analysis
This project is sectioned into 6 parts:
OLTP database- Design a data platform that uses MySQL as an OLTP database and MongoDB as a NoSQL databaseMongoDBData Warehouse Design, Setup, and Reporting- Design and implement a data warehouse and generate reports from the dataData Analytics Overview and Preparation- Design a reporting dashboard that reflects the key metrics of the businessETL & Data Pipelines- Extract data from OLTP and NoSQL databases, transform it and load it into the data warehouse, and then create an ETL pipelineBig Data Analytics with Spark- Create a Spark connection to the data warehouse, and then deploy a machine learning model
Tools/ Software: MySQL 8.0.22 , phpMyAdmin 5.0.4
- Design the OLTP database for an E-Commerce website, populate the OLTP Database with the data provided and automate the export of the daily incremental data into the data warehouse.
- Design a data platforms that uses MySQL as an OLTP databases. You will be using MySQL to store the OLTP data.
INPUT:CREATE DATABASE name
INPUT:CREATE TABLE name(columns1 data_type, columns2 data_type, columns3 data_type);
loading csv.files into database using phpMyAdmin
INPUT:SHOW TABLES IN sales ;
INPUT:select count() from table_name;*
INPUT:CREATE INDEX index_name ON table_name(column);
INPUT:SHOW INDEXES FROM sales_data;
create a bash script and using
mysqldumpcommand to export data
- design a data platform that uses MongDB as a NoSQL database and use it to store the e-commerce catalog data.
- set up a NoSQL database to store the catalog data for an E-Commerce website, load the E-Commerce catalog data into the NoSQL database, and query the E-Commerce catalog data in the NoSQL database.
Tools/Software: MongoDB Server, MongoDB Command Line Backup Tools
INPUT:start mongo db
1.2) Import 'catalog.json' into mongodb server in a database named 'catalog' and collection named 'eletronics'
INPUT:* mongoimport -u root -p xxxxxx --authenticationDatabase admin -db xxx --collection xxx -- file xxx.json*
INPUT:show dbs
INPUT:show collections
INPUT:db.collection.CreateIndex({"field:1})
INPUT:db.collection.count({type:"laptop"})
INPUT:mongoexport -u root -p --authentionDatabase admin --db catalog --collection electronics -- out electronic.csv
Tools/Software: ERD Design Tool of pgAdmin , PostgreSQL Database Server
- design the schema for a data warehouse based on the schema of the OLTP and NoSQL databases. You’ll then create the schema and load the data into fact and dimension tables, automate the daily incremental data insertion into the data warehouse, and create Cubes and Rollups to make the reporting easier
1.1) Design the relationships of fact table(SoftcartFactSales) and dimension tables(DimDate, DimCategory, DimItem, DimCountry)
Tools/software: PostgreSQL UI
select c.country, a.category, sum(f.amount) as total sales
from public."FactSales" f
left join public."DimCountry" c on f.countryid = c.countryid
left join public."DimCategory" a on a.categoryid = f.categoryid
group by grouping sets (a.category, c.country)SELECT c.country, a.year, sum(f.amount) as totalsales
from public."FactSales" f
left join public."DimCountry" c on f.countryid = c.countryid
left join public."DimDate" a on a.dateid = f.dateid
group by roll up (a.year, c.country):SELECT c.country, a.year, avg(f.amount) as average_sales
from public."FactSales" f
left join public."DimCountry" c on f.country.id = c.countryid
left join pubic."DimDate" a on a.dateid = f.dateid
group by cube (a.year, c.country);create table total_sales_per_country as (SELECT c.country, sum(f.amount) as total_sales
from public."FactSales" f
left join public."DimCountry" c on f.countryid = c.countryid
group by country
order by country asc;Tools/ Software: IBM cognoz Analytics, IBM DB2
- you will create a Cognos data source that points to a data warehouse table,
- create a bar chart of Quarterly sales of cell phones, create a pie chart of sales of electronic, goods by category, and create a line chart of total sales per month for the year 2020.
Part D : Synchronize data between staging and production warehouse by automate incremental loading process of sales data
tools/software: MySQL Server, IBM DB2 database running on IBM Cloud
you will extract data from OLTP, NoSQL, and MongoDB databases into CSV format. You will then transform the OLTP data to suit the data warehouse schema and then load the transformed data into the data warehouse. Finally, you will verify that the data is loaded properly.
you need to keep data synchronized between different databases/data warehouses as a part of your daily routine. One task that is routinely performed is the sync up of staging data warehouse and production data warehouse. Automating this sync up will save you a lot of time and standardize your process. you will be given a set of python scripts to start with. You will use/modify them to perform the incremental data load from MySQL server which acts as a staging warehouse to the IBM DB2 which is a production data warehouse. This script will be scheduled by the DE to sync up the data between the staging and production data warehouse.
Use start_mysql to connect MySQL server and create database name to create a db as staging area before loading into production data warehouse.
Use source command to load the dataset into staging data warehouse(MySQL)
Use query statement to examine whether the data has loaded in MySQL server
write a python script that automatically load additional values from staging warehouse(MySQL) that doesnt have in production warehouse(IBM DB2)
2.4) Load incremental data into production data warehouse by comparing the data from two different datawarehouse (Staging Data Warehouse vs Production Data Warehouse.
In the following diagram, we find the last row of row_id in sales_data from production data warehouse and then load the rows that are greater than last_rowid from staging data warehouse into production data warehouse. The additional rows are the incremental data and we automate it using python script. After we have completed the process, we close the connection from both data warehouse.
Part E : Develop a ETL pipeline that analyzes the web server log file, extracts the required lines and fields, transforms and loads into a file for further analysis
Tools/Technologise: Apache Airflow, Python
- Write a pipeline that analyzes the web server log file, extracts that required lines(ending with html) and fields(time stamp, size) and transforms (bytes to mb) and load (append to an exisiting file).
type start_airflow onto linux terminal to start the Apache Airflow tools











































