Skip to content

Data Lake with Spark. Fourth project from Data Engineer Nanodegree program on Udacity.

Notifications You must be signed in to change notification settings

kpilarski/nanodegree_data_lake_spark_project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Data Lake Project - Udacity Data Engineer Nanodegree

Project: Data Lake

Context

A music streaming startup, Sparkify, has grown their user base and song database even more and want to move their data warehouse to a data lake. Their data resides in S3, in a directory of JSON logs on user activity on the app, as well as a directory with JSON metadata on the songs in their app.

As their data engineer, you are tasked with building an ETL pipeline that extracts their data from S3, processes them using Spark, and loads the data back into S3 as a set of dimensional tables. This will allow their analytics team to continue finding insights in what songs their users are listening to.

You'll be able to test your database and ETL pipeline by running queries given to you by the analytics team from Sparkify and compare your results with their expected results.

Project Description

In this project, you'll apply what you've learned on Spark and data lakes to build an ETL pipeline for a data lake hosted on S3. To complete the project, you will need to load data from S3, process the data into analytics tables using Spark, and load them back into S3. You'll deploy this Spark process on a cluster using AWS.

Schema for implemented tables:

Fact tables:

  • songplays - records in log data associated with song plays i.e. records with page NextSong
    • songplay_id
    • start_time
    • user_id
    • level
    • song_id
    • artist_id
    • session_id
    • location
    • user_agent

Dimension tables:

  • users - users in the app

    • user_id
    • firstname
    • lastname
    • gender
    • level
  • songs - songs in music database

    • song_id
    • title
    • artist_id
    • year
    • duration
  • artists - artists in music database

    • artist_id
    • name
    • location
    • latitude
    • longitude
  • time - timestamps of records in songplays broken down into specific units

    • start_time
    • hour
    • day
    • week
    • month
    • year
    • weekday

ETL Pipeline

Datasets are stored in JSON format are retrieved from S3 bucket - log_data and song_data. Song data is a subset of Million Song Dataset. There is a script in main file 'etl.py' - and once executed it retrieves the song and log data from S3 bucket, then transforms the data into fact and dimension tables and finally loads output data to the S3. Whole ETL process in located in the etl.py file.

Steps in ETL:

  1. Loading AWS credentials
  2. Reading data from S3 bucket
  3. Transforming data with Spark
  4. Loading data to S3 bucket

Project structure:

  1. data - folder that contains data files
  2. dl.cfg - config file with AWS KEYS
  3. etl.py - ETL script (retrieving from S3, transforming and finally loading into S3)
  4. README.md - project description

How to start project?

  1. Firstly you need to create S3 bucket and complete your credentials in dl.cfg file

  2. then ETL script can be started with following command:

python etl.py

About

Data Lake with Spark. Fourth project from Data Engineer Nanodegree program on Udacity.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages