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.
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.
- 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
-
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
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:
- Loading AWS credentials
- Reading data from S3 bucket
- Transforming data with Spark
- Loading data to S3 bucket
- data - folder that contains data files
- dl.cfg - config file with AWS KEYS
- etl.py - ETL script (retrieving from S3, transforming and finally loading into S3)
- README.md - project description
-
Firstly you need to create S3 bucket and complete your credentials in dl.cfg file
-
then ETL script can be started with following command:
python etl.py