https://github.com/dina-hosny/sparkify---aws-redshift-data-warehousing
Sparkify - AWS Redshift Data Warehousing - Udacity Data Engineering Expert Track.
https://github.com/dina-hosny/sparkify---aws-redshift-data-warehousing
analytics aws data-engineering data-pipeline data-warehousing etl fwd redshift sql udacity
Last synced: 8 months ago
JSON representation
Sparkify - AWS Redshift Data Warehousing - Udacity Data Engineering Expert Track.
- Host: GitHub
- URL: https://github.com/dina-hosny/sparkify---aws-redshift-data-warehousing
- Owner: Dina-Hosny
- Created: 2022-11-07T08:54:38.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2023-01-02T16:25:45.000Z (almost 3 years ago)
- Last Synced: 2025-01-13T22:26:48.217Z (9 months ago)
- Topics: analytics, aws, data-engineering, data-pipeline, data-warehousing, etl, fwd, redshift, sql, udacity
- Language: Python
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Sparkify - AWS Redshift Data Warehousing
Sparkify - AWS Redshift Data Warehousing - Udacity Data Engineering Expert Track.In this project, I built an ETL pipeline for a database hosted on Redshift, loaded the data from S3 to staging tables on Redshift, and executed SQL statements that created the analytics tables from these staging tables.
## Project Datasets:
- Songs Dataset:
This dataset is a subset of real data from the [Million Song Dataset](http://millionsongdataset.com/). 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.
- Log Dataset:This dataset consists of log files in JSON format generated by this [event simulator](https://github.com/Interana/eventsim) based on the songs in the dataset above. These simulate activity logs from a music streaming app based on specified configurations. The files are partitioned by year and month.
## Project Files:
- ```sql_queries.py``` contains all sql statements to create and drops the tables .
- ```create_tables.py``` is where the fact and dimension tables for the star schema in Redshift are created.
- ```etl.py``` load the data from S3 into staging tables on Redshift and then process that data into analytics tables on Redshift.
- ```dwh.cfg``` contains the AWS connection variables and configurations.## Project Details:
The project's purpose is to move the Sparkify collected data related to their music streaming app onto the cloud. 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.
To do this, I built an ETL pipeline that extracts the Sparkify data from S3, stages them in Redshift, and transforms data into a set of dimensional tables for their analytics team to continue finding insights into what songs their users are listening to. Then tested the database and ETL pipeline by running given queries by the analytics team from Sparkify and compare the results with their expected results.
A star schema optimized for queries on song play analysis. It was created using the song and log datasets, and it includes the following tables:
- Fact Table
- ```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, first_name, last_name, 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## Tools and Technologies:
- Python 3.
- Pandas, NumPy, Psycopg2, configparser Python Libraries.
- ETL: Extract, Transform, Load Data
- Data Warehouse concepts.
- Cloud Computing concepts.
- AWS Services: IAM, VPC, S3, and EC2.
- SQL.
- Jupyter Notebook.
- PostgreSQL server.## Project Steps:
- 1- Planing for the database schema.
- 2- Write the SQL queries: create, drop, and select statements.
- 3- Connect the cloud database.
- 4- Launch a redshift cluster and create an IAM role that has read access to S3.
- 5- Implement the logic to load data from S3 to staging tables on Redshift.
- 6- Implement the logic to load data from staging tables to analytics tables on Redshift.
- 4- Develop the ETL processes for each table.
- 5- Build the ETL pipelines.
- 6- Test the results and check the table schemas in the redshift database.