This project reads data from three .CSV files and store it in a local PostgreSQL database. Once the data is ingested some operations are made to generate two specific outputs required by the stakeholders.
This project uses popular libraries like Flask, SQLAlchemy and Pandas.
Follow the next steps to execute the project:
Select a folder to store the code, the use the following command to clone the repository:
git clone https://github.com/SanchezFelipe01/globant_coding_challenge.git-
Install PostgreSQL: Ensure that PostgreSQL is installed on your machine. You can download it from the PostgreSQL Official Website.
-
Create the Database: Create a database in PostgreSQL with the name of your choice. You can use the command-line interface (
psql) or a graphical tool like PgAdmin. -
Username and Password: Make sure you have a user and password with sufficient privileges to access and modify the database you created.
It's recommended to set up a virtual environment to manage project dependencies. Follow these steps:
-
Install virtualenv (if not installed):
pip install virtualenv
-
Navigate to your project directory:
cd path\to\your\project
-
Create a new environment:
python -m venv .\venvo
py -m venv .\venv -
Activate the new environment:
.\venv\Scripts\Activate
Use the following command to install the project dependencies. It's recommended to set up a virtual environment before installing dependencies.
pip install -r requirements.txtThe db_config.py file contains the connection information for the database, modify it if necessary.
In this case, the first postgres is the username, 12345 is the password and the second postgres is the database name.
# db_config.py
class Config:
SQLALCHEMY_DATABASE_URI = 'postgresql://postgres:12345@localhost/postgres'
SQLALCHEMY_TRACK_MODIFICATIONS = FalseOpen a terminal and go to your project root folder, then execute this command:
python .\app\__main__.pyAfter that, in your browser go to http://127.0.0.1:5000/. Now you can interact with the application.
alternatively, you can use docker to build the application in less steps (you need docker to be installed in your computer):
- Once you have cloned the repository, go to the root folder
cd /../../globant_coding_challenge- Use the following command to build the docker image
docker-compose build- Execute the container
docker-compose upAfter that, in your browser go to http://127.0.0.1:5000/. Now you can interact with the application.