Coder Social home page Coder Social logo

divvy_azure_synapse's Introduction

Building an Azure Data Warehouse for Bikeshare Data Analytics

Divvy is a bike sharing program in Chicago, Illinois USA that allows riders to purchase a pass at a kiosk or use a mobile application to unlock a bike at stations around the city and use the bike for a specified amount of time. The bikes can be returned to the same station or to another station. The City of Chicago makes the anonymized bike trip data publicly available for projects like this where we can analyze the data.

The goal of this project is to develop a data warehouse solution using Azure Synapse Analytics. It involved:

  • Designing a star schema based on the business outcomes listed below;
  • Importing the data into Synapse;
  • Transforming the data into the star schema;
  • and finally, viewing the reports from Analytics.

ERD

Dataset

The data contains 4 initial tables:

  • trip with 4584921 records

trip

  • station with 838 records:

station

  • payment with 1946607 records:

payment

  • rider with 75000 records:

rider

Extract and Load

In Azure synapse, linked services were set up to postgres and azure blob storage.

linked services

Using postgres as source and azure blob storage as destination, the 4 tables were ingested into blob storage and saved as comma delimited files.

blob storage

In Azure Synapse, the 4 files were loaded as external staging tables trip, payment, rider,station into Azure SQL pool via Polybase.

SQL Pool setup

Transformation scripts were written to create final tables according to the star schema: fact tables trips and payments and dimension tables riders, date, stations

Transform

Transformation was done in line with the entity relationship diagram as guiding architecture. SQL scripts are in the sql folder.

Challenges

  1. Initially, setting up data source for copy task could not connect to postgres database with error no pg_hba.conf entry for host "4X.XXX.XX.XXX", user "userXXX", database "dbXXX". It was resolved by enabling encryption.

  2. Data files were too heavy to commit to github. Push command kept failing with Large files detected. even after these files have been uncommitted. It turns out they were still in git log history and had to be forced out via git filter-branch --index-filter "git rm -r --cached --ignore-unmatch data" HEAD

  3. Creating a date dimension in Azure Synapse came with challenges as I could not use recursive CTEs which was the first approach I attempted. I adapted the Azure SQL script for creating date timension by Meagan Longoria to resolve the challenge.

divvy_azure_synapse's People

Contributors

obinnaonyema avatar

Watchers

James Cloos avatar  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.