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.
- Python 3.6 and above
- GIT setup and configured for SSH
- Docker (If running locally)
THe following shows the file in the repository
├── Dockerfile ' File to create the Docker Image for Apache Spark
├── LICENSE
├── README.md ' File describing the projects
├── data ' Folder to store data for running locally
├── data_analysis.ipynb ' Data Analysis document to study data
├── dl.cfg.template ' Configuration file if running against AWS S3
└── etl.py ' Code file for project
- Clone repository by running
git clone [email protected]:seetdev/dend-p4.git
- Go into the cloned folder
- Create folders for
data/input
anddata/output
- Download log-data and song_data from
s3a://udacity-dend
intodata/input
- Setup the docker image by running
docker build --tag udacity-dend/pyspark-notebook .
- Start docker container by runnin
docker run --rm -d -p 8888:8888 -e JUPYTER_ENABLE_LAB=yes -v $PWD:/home/jovyan/work --name spark udacity-dend/pyspark-notebook
- In
etl.py
comment the block just below## S3 block
and uncomment the block between## Local block
and## S3 block
- Run
python ./etl.py
- Clone repository by running
git clone [email protected]:seetdev/dend-p4.git
- Go into the cloned folder
- Create the output bucket in S3
- Renamed
dl.cfg.template
todl.cfg
and fill up the variables - Setup the docker image by running
docker build --tag udacity-dend/pyspark-notebook .
- Start docker container by runnin
docker run --rm -d -p 8888:8888 -e JUPYTER_ENABLE_LAB=yes -v $PWD:/home/jovyan/work --name spark udacity-dend/pyspark-notebook
- In
etl.py
uncomment the block just below## S3 block
and comment the block between## Local block
and## S3 block
- Run
python ./etl.py
root
|-- song_id: string (nullable = true)
|-- title: string (nullable = true)
|-- artist_id: string (nullable = true)
|-- year: long (nullable = true)
|-- duration: double (nullable = true)
root
|-- artist_id: string (nullable = true)
|-- name: string (nullable = true)
|-- location: string (nullable = true)
|-- latitude: double (nullable = true)
|-- longitude: double (nullable = true)
root
|-- user_id: string (nullable = true)
|-- first_name: string (nullable = true)
|-- last_name: string (nullable = true)
|-- gender: string (nullable = true)
|-- level: string (nullable = true)
root
|-- start_time: timestamp (nullable = true)
|-- hour: integer (nullable = true)
|-- day: integer (nullable = true)
|-- week: integer (nullable = true)
|-- month: integer (nullable = true)
|-- year: integer (nullable = true)
|-- weekday: string (nullable = true)
root
|-- start_time: timestamp (nullable = true)
|-- user_id: string (nullable = true)
|-- level: string (nullable = true)
|-- song_id: string (nullable = true)
|-- artist_id: string (nullable = true)
|-- session_id: long (nullable = true)
|-- location: string (nullable = true)
|-- user_agent: string (nullable = true)
|-- year: integer (nullable = true)
|-- month: integer (nullable = true)