Giter Site home page Giter Site logo

sunrise-sunset-data-etl's Introduction

INTRODUCTION

This page will give the details about tap and target of an ETL pipeline which does historical and incremental loading of sunrise and sunset details of Pune (Maharashtra, India)

SETTING UP ENVIRONMENT FOR TAP

The template of the tap is taken from here.

You can do the setup as follows

For linux :

cd tap-sunrise-sunset
python3 -m venv ~/.virtualenvs/tap-sunrise-sunset
source ~/.virtualenvs/tap-sunrise-sunset/bin/activate
pip install -e .
deactivate

For windows :

python -m venv virtualenvs/tap-sunrise-sunset
.\virtualenvs\tap-sunrise-sunset\Scripts\activate
cd tap-sunrise-sunset
pip install -e .
deactivate

SETTING UP ENVIRONMENT FOR TARGET

The target is taken from here

You can do the setup for target as follows

For linux:

cd target-sqlite-master
python3 -m venv ~/.virtualenvs/target-sqlite-master
source ~/.virtualenvs/target-sqlite-master/bin/activate
pip install -e '.[dev]'
deactivate

For windows:

python -m venv virtualenvs/target-sqlite-master
.\virtualenvs\target-sqlite-master\Scripts\activate
cd target-sqlite-master
pip install -e '.[dev]'
deactivate

RUNNING THE TAP AND TARGET

The config for tap is tap_sunrise_sunset/config.json and config for target is target-sqlite-master/config.json.

Users have 2 options that is load the historical data or load the incremental data.

  • Historical Load : loads historical data. The default start date is 1st Jan 2020.
  • Incremental Load : Append today’s data in existing target

LOADING THE HISTORICAL DATA

Run the following command to load the historical data (will load the date from 1st Jan 2020 to current date)

For linux:

~/.virtualenvs/tap-sunrise-sunset/bin/tap-sunrise-sunset --config tap_sunrise_sunset/config.json | ~/.virtualenvs/target-sqlite-master/bin/target-sqlite -c target-sqlite-master/config.json 

For windows:

.\virtualenvs\tap-sunrise-sunset\Scripts\tap-sunrise-sunset.exe --config .\tap-sunrise-sunset\config.json | .\virtualenvs\target-sqlite-master\Scripts\target-sqlite.exe -c .\target-sqlite-master\config.json

After running this state.json and sunrise_sunset.db files will be created. The state.json will store the date till which the data was loaded.

A sample state.json looks like this

{
    "end_date": "2021-06-13"
}

LOADING THE INCREMENTAL DATA

If a user wants to load incremental data, the user should give the state.json filepath as input (that was created while loading the historical data) in the following way:

For linux:

~/.virtualenvs/tap-sunrise-sunset/bin/tap-sunrise-sunset --config tap-sunrise-sunset/config.json --state state.json | ~/.virtualenvs/target-sqlite-master/bin/target-sqlite -c target-sqlite-master/config.json 

For windows:

.\virtualenvs\tap-sunrise-sunset\Scripts\tap-sunrise-sunset.exe --config .\tap-sunrise-sunset\config.json --state .\state.json | .\virtualenvs\target-sqlite-master\Scripts\target-sqlite.exe -c .\target-sqlite-master\config.json

The date stored in state.json will be used as starting date and data will retrieved till the current date. After running this, sunrise_sunset.db will get updated with new incremental data and also state.json will get udpated with current_date.

LOADING EVERYDAY DATA

Only for the first time, user has to run the historical data. Then for every day he can run the incremental load to load the data for that day.Before running incremental data he has to run historical data atleast once. You need to setup tap and target only for the first time.

sunrise-sunset-data-etl's People

Contributors

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