Skip to content

loads s3 json files into redshift staging tables, then transforms them into a star schema

Notifications You must be signed in to change notification settings

MartyP233/s3-to-redshift-pipeline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

S3 to Redshift Pipeline

Loads S3 json files into redshift staging tables, then transforms them into a star schema.

Motivation

Experimentation and learning of AWS resources such as S3 and Redshift. This project was created as part of the Data Engineering Nano Degree, run by Udacity.

The Project Scenario

A music streaming startup, Sparkify, has grown their user base and song database and want to move their processes and data 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.

As their data engineer, you are tasked with building an ETL pipeline that extracts their data from S3, stages them in Redshift, and transforms data into a set of dimensional tables for their analytics team to continue finding insights in what songs their users are listening to.

Data Sets

The pipeline process 2 types of JSON data file

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

Log dataset

The log datasets contain activity logs from the music streaming app, and are partitioned by year and month.

Screenshots

Redshift

Tech used

Establishing the redshift cluster with Infrastructure as Code (IaC)

Built with

  • The boto3 package for AWS (Python)
  • Python and SQL for ETL pipeline

Features

  • IaC means redshift can be established and taken down within the session, saving on redshift cluster costs.
  • S3 COPY function + redshift utilises parallel reads on mutiple json files

Running the process

The process is typically run in the following order:

More detail on script files and their purpose

sql_queries.py

  • contains the SQL queries that are applied in both the create_tables.py file and the etl.py file

create_tables.py

  • establishes the database connection, drops and recreates the database and the tables within it

etl.py

  • processes and loads json data into staging tables in the redshift
  • transforms data from staging tables into a star schema for analysis

About

loads s3 json files into redshift staging tables, then transforms them into a star schema

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages