Giter VIP home page Giter VIP logo

data-modeling-of-music-streaming-app-with-postgres's Introduction

Data Modeling & ETL Pipeline for Sparkify using Postgres


Introduction

Sparkify is a music streaming app. The analytics team is particularly interested in understanding what songs users are listening to. Currently, their data resides 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. However, this cannot provid an easy way to query the data.

The log files in the dataset are partitioned by year and month.

Song Dataset


The first dataset 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.

Log Dataset


The second dataset consists of log files in JSON format generated by this event simulator based on the songs in the dataset above. These simulate activity logs from a music streaming app based on specified configurations.

The goal


The purpose of this project is to create a Postgres database and ETL pipeline to optimize queries to help Sparkify's analytics team.

Database & ETL pipeline


Using the song and log datasets, I created a star schema as shown below, which includes

  • 1 fact table: songplays, and
  • 4 dimension tables: users, songs, artists and time.

drawing

Steps to execute code

  1. Unzip data.7z folder.
  2. Run create_tables.py to create your database and tables.

python create_tables.py

  1. Open and execute test.ipynb to confirm the creation of your tables with the correct columns. Make sure to click "Restart kernel" to close the connection to the database after running this notebook.
  2. Run etl.py to execute ETL process which loads entire data from json files into corresponding tables.

python etl.py

  1. Run test.ipynb to confirm that records were successfully inserted into each table.

data-modeling-of-music-streaming-app-with-postgres's People

Contributors

sudip-padhye avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.