Code Monkey home page Code Monkey logo

premium_db's Introduction

Premium_db

A sqlite database which contains premium payments. Each row corresponds to a monthly payment.

By creating a python class with 3 methods (download_data, process_data, save_data), try to create a new database where data structure allows to find easily churn on products or new subscribers

Some explanations on repo

Quick description of the repo

  • The ETL process is executed in etl_premium_clients.main.py: here
  • Main script calls PerformETL python class which executes load, transform and extract functions: here
  • The output of the ETL process is stored in here
  • Logs of main execution are stored : here
  • Some tests are stored: here
  • ETL process can be executed in a docker container. The dockerfile: here
  • Check data folder here where sqlite output is persisted when script is run into container
  • Metabase (GUI) has been plug on output database : you can access on localhost after starting docker-compose

Some tips on repo

  • If you decide to run locally the script without specifiyng custom args, you can use the 'make run' command
  • Otherwise, you can specify your own arguments described in utils script : here

Running files

Run with docker

# build etl process image (not pushed in dockerhub yet)
docker build . -t etl_process -f Dockerfile
# run etl process into docker container with default args
docker run -v $(PWD)/data:/app/etl_premium_clients/db/output etl_process

# to run metabase and see some analytics KPI
docker-compose -up
http://localhost:3000/

Local development

Python >= 3.8

virtualenv -p python3.8 venv
source venv/bin/activate
pip3 install -r requirements.txt

# Local run 
make run (takes default values)
or 
python -m etl_premium_clients \
    --input_db <path to input db> \
    --input_table <name of sqlite table> \
    --custom_path <True or False - Always true if you define your own path to db> \
    --output_name_db <name of db transformed (output of ETL process)>
    
# Local linter
make linter

# Local test
make tests

References

TO DO

  • deals with volume for etl sqlite container
  • add logs for unit test
  • add unit test for load and extract steps
  • add github actions

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.