https://github.com/diogo364/db-from-scratch
https://github.com/diogo364/db-from-scratch
docker docker-compose postgresql shell-script
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/diogo364/db-from-scratch
- Owner: Diogo364
- License: mit
- Created: 2022-06-29T21:44:48.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-07-05T17:56:10.000Z (almost 4 years ago)
- Last Synced: 2025-12-07T23:42:28.631Z (7 months ago)
- Topics: docker, docker-compose, postgresql, shell-script
- Language: Shell
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Data Base from Scratch
- [Data Base from Scratch](#data-base-from-scratch)
- [About](#about)
- [Requirements](#requirements)
- [Quickstart](#quickstart)
- [split_data.sh](#split_datash)
- [setup.sql](#setupsql)
## About
It creates a Relational Data Base to store [Historical Series of fuel prices by resale](https://www.kaggle.com/upadorprofzs/historical-series-of-fuel-prices-by-resale) data. It uses PostgreSQL Relational Data Base, Docker, Shellscript and a CSV file.
## Requirements
- Docker
- Docker-compose
- Download the CSV file from [this link](https://www.kaggle.com/upadorprofzs/historical-series-of-fuel-prices-by-resale)
## Quickstart
These are the steps to run the application:
1. Download the CSV data file;
2. Update the Environment Variables within the `.env` file with:
- DB deployment port;
- Name of the csv data file;
- DB password;
3. Build the Docker image:
```
docker-compose build
```
4. Start the container in detached mode:
```
docker-compose up -d
```
5. Connect to the `AA Database` using [Postgresql](https://www.postgresql.org/download/), [Sqlectron](https://sqlectron.github.io/) or similar and enjoy!
## split_data.sh
This Shellscript was prepared to split the `Historical Series of fuel prices by resale` structured data into two smaller entities tables: `revenda.csv` and `produtos.csv`. It also removes the duplicated `CNPJ` from `revenda.csv`, since it is considered Primary Key.
## setup.sql
It creates both DB Schemas, Revenda and Produtos, and copies the data within the splitted tables into the DB.