Converting JSON files into DB tables and manipulating data using SQL queries and completed loading all finished results into JSON file.
1) in terminal write a command ->
docker-compose up --build
after then will be created docker container with DB PostgreSQL 16 and base credentials as in file docker-compose.yml (docker and postgres must be installed on your computer before)
2) connect with DB with credentials from docker-compose.yml
you can change all credentials but before building of DB
3) all SQL queries exist in SQL_task1.sql
you can find it in general folder of project
it's queries and index optimization
4) according on SQL queries in psql_query_terminal.txt you can use commands in terminal for creating new JSON files with results of each queries
psql_query_terminal.txt
5) inside py_test folder test_json_files.py
this test check of file in jsons_file if did have JSON files in folder or not and if this file exist test check that files not empty
pytest will be installed (for example pip install pytest)
6) start test with ->
pytest -vs test_json_files.py
task1/ (main directory)
| jsons/ (work directory)
| | jsons_file/ (JSON's file directory)
| | | - rooms.json
| | | - students.json
| | - .gitignore
| | - config.py
| | - data_loader.py
| | - database.py
| | - main.py
| | - pre-commit-config.yaml
| | - requirements.txt
| py_test/ (tests directory)
| | - test_json_files.py
| sql_query_results/ (SQL queries results in JSON directory)
| | - rooms_students_count.json
| | - rooms_with_multiple_genders.json
| | - top_5_rooms_by_age_range.json
| | - top_5_rooms_by_average_age.json
| - docker-compose.yml
| - dockerfile
| - psql_query_terminal.txt
| - SQL_task1.sql