Git Product home page Git Product logo

cassandra-data-modeling's Introduction

cassandra-data-modeling

Udacity Data Engineer Nanodegree project

A startup called Sparkify wants to analyze the data they've been collecting on songs and user activity on their new music streaming app. The analysis team is particularly interested in understanding what songs users are listening to. Currently, there is no easy way to query the data to generate the results, since the data reside in a directory of CSV files on user activity on the app.

They'd like a data engineer to create an Apache Cassandra database which can create queries on song play data to answer the questions. The task is to create a Cassandra database for this analysis.

Requirements for running locally

  • Python3
  • Docker
  • Docker-Compose

Project structure explanation

postgres-data-modeling
│   README.md                 # Project description
│   docker-compose.yml        # Postgres container description   
│   requirements.txt          # Python dependencies
|
└───event_data                # The dataset partitioned by day
|   | ...
|                 
└───src                       # Source code
|   |               
│   └───notebooks             # Jupyter notebooks
│   |   │  music_app.ipynb    # Interactive notebook instead of python scripts
|   |   
|   └───scripts
|       |  process_events.py  # Collect records in one csv file
│       │  create_tables.py   # Schema creation script
|       |  etl.py             # ETL script
|       |  csql_queries.py    # Definition of all csql queries

Instructions for running locally

Clone repository to local machine

git clone https://github.com/brfulu/cassandra-data-modeling.git

Change directory to local repository

cd cassandra-data-modeling

Create python virtual environment

python3 -m venv venv             # create virtualenv
source venv/bin/activate         # activate virtualenv
pip install -r requirements.txt  # install requirements (this can take couple of minutes)

Start cassandra container

docker-compose up  # run this command in new terminal window or tab

Run scripts

cd src/
python -m scripts.process_events # collect events into one csv (event_datafile_new.csv)
python -m scripts.create_tables  # create database schema
python -m scripts.etl            # load data

Run everything inside jupyter notebook or check results

jupyter notebook  # launch jupyter notebook app

# The notebook interface will appear in a new browser window or tab.
# Navigate to src/notebooks/music_app.ipynb and run the code cells

cassandra-data-modeling's People

Contributors

brfulu 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.