A command-line Python application for managing a music institute's records — learners, staff, and instructional resources — backed by a MySQL database.
- First-run setup: automatically creates the
iMusicdatabase, required tables, and sample seed data. - Learners: add, view (by ID, name, genre, area, or all), update, and delete learner records.
- Staff: add, view (by ID, name, designation, salary, or join date), update, and delete staff records.
- Resources Issued: issue a resource to a learner, view all issued resources, and process returns.
- Resources Available: add new resources, adjust available quantity (increase/reduce), and view current stock.
- Table Schema Viewer: inspect the structure of any table in the database.
The app manages four tables inside a MySQL database named iMusic:
| Table | Description |
|---|---|
Learners |
Student records: ID, name, genre, phone, area |
Staff |
Staff records: ID, name, designation, date of join, salary |
ResourcesIssued |
Tracks which learner has which resource, and when it was issued |
ResourcesAvailable |
Master list of resources with available/issued counts |
- Python 3
- MySQL server (running locally)
mysql-connector-pythonpackage
Install the dependency with:
pip install mysql-connector-python- Make sure a MySQL server is running and you have valid login credentials.
- Run the script:
python imusic.py
- Enter your MySQL username and password when prompted.
- On the first run, press
1to set up the database and load sample data. On subsequent runs, press any other key to skip setup. - Use the on-screen numbered menus to navigate between:
- Viewing tables and schemas
- Managing Learners
- Managing Staff
- Managing Resources Issued
- Managing Resources Available
- SQL queries are built with string formatting rather than parameterized queries, so untrusted input should not be used with this tool as-is.
- Some availability checks (e.g. in
issue_new()andresources_return()) compare a fetched row list to0, which will not behave as intended and should be reviewed before production use. add_resource()currently inserts a hardcoded resource rather than using the values entered by the user.- No input validation is performed on IDs, dates, or numeric fields.
No license specified.