GithubHelp home page GithubHelp logo

hawatel-task's Introduction

Recruitment tasks for Junior Python Developer

Project overview

The project was created for the recruitment process for Hawatel. Given task could be described in list as follow:

  1. Configure the mysql database mydb from given scripts Schema and Data.
  2. Alter the product table with two additional columns UnitPriceUSD and UnitPriceEuro.
  3. Create Python script to gather information from Polish National Bank REST API and update products data.
  4. On demand script should also export list of all products to Excel format.

Other requirements:

  • Script should be written in OOP
  • Script should be documented
  • Export altered database schema
  • Script should use logging module
  • Script should handle exceptions
  • Optional: Script should be created in python packaging format to install the script with pip install <module_name>.whl

Installation

Database

  • To create the database type docker-compose up --build
  • To run the container type docker-compose up
  • To run the container in the background type docker-compose up -d
  • To stop the container type docker-compose stop
  • To delete the database and it's volumes type docker-compose down -v
  • To open mysql shell type docker-compose exec mysql /bin/bash while the container is running and after that type mysql -u user -puser

Python Script

  • Create virtual environment python3 -m venv venv
  • Change virtual environment source venv/bin/activate
  • Install required packages pip3 install -r requirements.txt
  • Run script with python3 script.py

Script options

  • -h, --help

show help message and exit

  • --host HOST

set database host, default 127.0.0.1

  • --user USER, -u USER

set database user, default user

  • --password PASSWORD, -p PASSWORD

set database password, default user

  • --db DB

set database name, default mydb

  • --export, --no-export, -e

exports data from database to external file

  • --type TYPE

set export file format, default excel

  • --filename FILENAME

set export filename, default ./export

  • --log_path LOG_PATH

set log path, default ./

Bugs Found

  • In Schema was mistype on check for Sellers Table which caused a check constraint violation while importing data for the sellers table.
...
CHECK (USER_TYPE = 'B'))
...

Should be this

...
CHECK (USER_TYPE = 'S'))
...

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.