I am making a school-related app for school using Python and the PeeWee module. Everything is working fine, but the problem I am facing is as follows:
When creating user accounts, a student account can ONLY be created if there is at least 1 teacher account in the database (every student gets a teacher assigned). How do I check if my teacher table has any instances? I want to check this before a student user account can be made.
Thanks in advance!
If I understand your problem clearly then it seems you need foreign key in student table. If you have column like teacher_id in student table then do the below steps

Create primary key for id in teacher table
Create foreign key for teacher_id in student table and teacher_id is not null

Once you have foreign key in student table then database will automatically will check teacher exists or not. if teacher not exists then it will throw error.
Checking if a table has records - Peewee module