Xeneta Task
This project was a Xeneta task
I did not use docker so i installed pg admin and postgres using the link attached You can learn more in the Install postgresql and pg admin to run the database if you prefer atool for easy script running
Alternatively, you can only install postgres and run the commands in the terminal. Here are some commands to help after postgres is installed
sudo su postgres
#psql
\l -lists all databases
\c xeneta2 -use xeneta2 database
\dt -show all tables
In the project run
Runs the app in the development mode.\
Open http://localhost:5000 to view it in the browser.
The page will reload \
I created to API endpoints: http://127.0.0.1:5000/
This will read out all the ports in the database
http://127.0.0.1:5000/rates This returns a list with the average prices for each day on a route between port codes origin and destination.
Return an empty value (JSON null) for days on which there are less than 3 prices in total.
Postgres connection to the Flask Framework was not straight forward in the Flask documentation.
Failure to bulk import the data into the tables .. so i used bulk inserts in phases.
Query returning not desired output as seen in the task example.
This assignment has taken me Close to 5 hours.
To learn Flask, check out the Flask documentation.