For this project I build an ETL pipeline for a Data Lake hosted on S3. It was part of my Udacity Nanodegree in Data Engineering.
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.
The database is based on two datasets.
- The song dataset
(s3://udacity-dend/song_data)
is a subset of real data from the Million Song Dataset. Each file is in JSON format and contains metadata about a song and the artist of that song. The files are partitioned by the first three letters of each song's track ID. - The logfile dataset
(s3://udacity-dend/log_data)
consists of log files in JSON format generated by an Event Simulator based on the songs in the song dataset. It simulates activity logs from a music streaming app based on specified configurations. The log files are partitioned by year and month.
The data is modeled after the star schema. The Star Schema separates business process data into facts, which hold the measurable, quantitative data about a business, and dimensions which are descriptive attributes related to fact data.
For the Sparkify data lake we have the 'songplays' table as the fact table and the 'songs', 'artists', 'users', and 'time' tables as dimension tables.
etl.py
contains code to extract the JSON files from S3, process them via Spark und write them back to S3 using the parquet formatdl.cfg
contains the parameters to connect to the AWS workspace. For security reasons this file does provide the structure, but no real values.
- create an AWS ACCESS KEY and update AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY in
dl.cfg
- create a output bucket in AWS S3 and add the path in
etl.py
line 152 - run
python etl.py
in the terminal