Giter Site home page Giter Site logo

yanchen2016 / beginner_de_project Goto Github PK

View Code? Open in Web Editor NEW

This project forked from josephmachado/beginner_de_project

0.0 0.0 0.0 711 KB

Data Pipeline project for data engineer

License: Apache License 2.0

Dockerfile 14.12% Shell 30.79% TSQL 10.95% Python 44.14%

beginner_de_project's Introduction

Beginner DE Project - Batch Edition

If you are interested in step by step explanation and review, check out the post for this repo at project-for-beginners-batch-edition

Prereq

  1. docker (also make sure you have docker-compose) we will use this to run Airflow locally
  2. pgcli to connect to our databases(postgres and Redshift)
  3. AWS account to set up our cloud components
  4. AWS Components to start the required services

By the end of the setup you should have(or know how to get)

  1. aws cli configured with keys and region
  2. pem or ppk file saved locally with correct permissions
  3. ARN from your iam role for Redshift
  4. S3 bucket
  5. EMR ID from the summary page
  6. Redshift host, port, database, username, password

Design

Engineering Design

Data

Data is available at data.Place this folder within the setup folder as such setup/raw_input_data/

Setup and run

local

In you local terminal type within your project base directory

docker-compose -f docker-compose-LocalExecutor.yml up -d

Then wait a couple seconds and sign into the Airflow postgres metadata database(since our data is small we pretend that our metadata database is also our OLTP datastore)

pgcli -h localhost -p 5432 -U airflow

and run the script at setup/postgres/create_user_purchase.sql.

Redshift

Get the redshift cluster connection details and make sure you have a spectrum IAM role associated with it(as shown in AWS Components ) log into redshift using pgcli

pgcli -h <your-redshift-host> -p 5439 -d <your-database> -U <your-redshift-user>
# type password when prompted

In the redshift connection run the script at setup/redshift/create_external_schema.sql, after replacing it with your iam role ARN and s3 bucket.

log on to www.localhost:8080 to see the Airflow UI Create a new connection as shown below for your 'redshift'

Airflow Redshift Connection Airflow Redshift Connection

EMR

Get your EMR ID from the EMR UI, then in dags/user_behaviour.py fill out your BUCKET_NAME and EMR_ID.

switch on your DAG, after running successfully, verify the presence of data in redshift using select * from public.user_behavior_metric limit 10;.

Stop

From your AWS console, stop the redshift cluster and EMR cluster In you local terminal type within your project base directory

docker-compose -f docker-compose-LocalExecutor.yml down

beginner_de_project's People

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.