Skip to content

This project is a command-line Student Database Management System built with Python. It provides a simple, text-based menu for users to interact with a PostgreSQL database. The application is designed for a university lab assignment, demonstrating how to connect a programming language to a relational database to perform fundamental data operations.

Notifications You must be signed in to change notification settings

sashankL-01/python-menu-based-program-for-postgres

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python and PostgreSQL Interaction

This project implements a simple Student Database Management System using Python and a PostgreSQL database running in Docker.

Setup

  1. Install Docker: Ensure Docker is installed and running on your system. [cite: 7]

  2. Start PostgreSQL Container: Open a terminal and run the following command to start a PostgreSQL container named pg_lab (this is slightly different from the PDF to give it a name, which is good practice).

    docker run --name pg_lab -e POSTGRES_PASSWORD=admin123 -p 5432:5432 -d postgres
  3. Create the Database: You must create the studentdb database before running the Python program.

    # Get a shell inside the running container
    docker exec -it pg_lab psql -U postgres
    
    # Inside the psql shell, run:
    CREATE DATABASE studentdb;
    
    # Type \q to exit psql
  4. Install Python Dependencies: Install the required psycopg2 library.

    pip install -r requirements.txt

Execution

To run the program, execute the main.py file from your terminal:

python main.py

About

This project is a command-line Student Database Management System built with Python. It provides a simple, text-based menu for users to interact with a PostgreSQL database. The application is designed for a university lab assignment, demonstrating how to connect a programming language to a relational database to perform fundamental data operations.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages