Git Product home page Git Product logo

etl_batch_processing-covid19's Introduction

ETL_Batch_Processing-COVID19

image

This project is demonstrate ETL Batch Processing using HDFS as a data lake, pyspark as a data processing and airflow as an orchestrator. The purpose of this project is to create data pipeline from raw data to data lake (HDFS), transform and processing it into dim table and fact table using pyspark and store it into data warehouse (postgreSQL). All the process will be scheduled to do everyday using Airflow as scheduler and monitoring process. For the dataset i use 'covid-19 data from Jawa Barat' in json format.


Table of Contents

  • Prepare the Dataset
  • Design ERD
  • Extract Dataset to MySQL
  • Transform Raw Data
  • Load to PostgreSQL
  • Create DAG
  • Result

1. Prepare the Dataset

image

This raw data i got from digital skola tutor


2. Design ERD

image

3. Extract Dataset to HDFS

I create a file called ingest.py that has job to load the dataset from local into HDFS using write method from pyspark.

...
data.write.mode("overwrite").option("header",True).csv("hdfs:///covid19/raw_data_airflow2")
...

4. Transform Raw Data

I transform the raw covid19 Jawa Barat dataset into 3 dimension tables [dim_province,dim_district,dim_case] and 6 fact tables [fact_province_daily, fact_province_monthly, fact_province_yearly, fact_district_daily, fact_district_monthly, fact_district_yearly].

5. Load to PostgreSQL

To load data i use postgeSQL JDBC Driver that allows our programs to connect to a PostgreSQL database using standard, database independent Java code. The way i used it is decalre it at the config when i create spark session.

spark=SparkSession.builder.appName("Submitted2").config("spark.jars", "file:///home/hadoop/postgresql-42.2.6.jar").getOrCreate()

6. Create DAG

Last for doing this task every day automaticaly, i use airflow as an orchestrator. To do that i need to create DAG (Directed Acyclic Graph). in this file i scheduled the task to repeat daily using cron_preset on airflow that present as @daily and using airflow BashOperator for running the python using bash command. the DAG graph will be look like this: image

7. Result

After the DAG running successfully the data lake (HDFS) and the data warehouse (PostgreSQL) will be look like this: image image image

etl_batch_processing-covid19's People

Contributors

indraryadi avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.