from src import db
from sqlalchemy import Select, func
from src.models import StudentTable

def find_students_by_school_grade_section(school_id, grade, section):
    stmt = Select(func.count(StudentTable.id)).where(
        StudentTable.school_id == school_id,
        StudentTable.grade == grade,
        StudentTable.section == section
    )
    count = db.session.execute(stmt).scalar()
    return count